pangeo-data/pangeo-stacks

Rasterio not working in latest notebook image

alando46 opened this issue · 6 comments

docker run pangeo/notebook:86665a6 followed by docker exec -it <name of container> bin/bash
and finally, python and import rasterio.

>>> import rasterio
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/lib/python3.6/site-packages/rasterio/__init__.py", line 22, in <module>
    from rasterio._base import gdal_version
ImportError: libncurses.so.6: cannot open shared object file: No such file or directory
>>> import cartopy
>>> 

Anyone know of a way to configure the dockerfile so if a package doesn't install properly the build stops?

Hm, this may be more complicate than a package that ddidn't install properly. It is possible that rasterio package is properly installed, but it doesn't find a required dependency (e.g. GDAL), that has not been installed on the system.

#71 should solve that, conda environments are more self coherent that pip installs.

@guillaumeeb hmm it looks like conda is already handling the rasterio installation.

Oh sorry, my bad!

hey @alando46 , what versions of rasterio and gdal end up getting installed? I haven't been following the pangeo deployments very closely, but I'm wondering the pros and cons of pinning all the package numbers? for example:
https://github.com/scottyhq/stac-intake-landsat/blob/master/binder/environment.yml

Seems there are efforts happen right now to facilitate things:
pangeo-data/pangeo#535

pip freeze | grep rasterio gives me rasterio==1.0.13.

jovyan@f70c3ddad94c:~$ gdalinfo
gdalinfo: error while loading shared libraries: libncurses.so.6: cannot open shared object file: No such file or directory

If part of the discussion around pangeo-data/pangeo#535 is in regards to setting up default dockerfiles for different types of deployments, I'd be happy to contribute to setting up a default dockerfile/image for EO workflows.

Haha sadly I just realized this isn't the first time I've talked to @scottyhq about issues installing gdal ;)

Update:
Earlier I was pulling the dockerfile from the dockerhub. I tried cloning the github repo and built the dockerfile locally, and now

jovyan@c35b51f03a62:~$ gdalinfo --version
GDAL 2.3.2, released 2018/09/21

promisingly rasterio still imports

jovyan@c35b51f03a62:~$ pip freeze | grep rasterio
rasterio==1.0.13

but alas when I open a python shell:

jovyan@c35b51f03a62:~$ python
Python 3.6.6 | packaged by conda-forge | (default, Oct 12 2018, 14:43:46) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import rasterio
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/lib/python3.6/site-packages/rasterio/__init__.py", line 22, in <module>
    from rasterio._base import gdal_version
ImportError: /opt/conda/lib/python3.6/site-packages/rasterio/../../../libgdal.so.20: undefined symbol: _ZN6libdap3DDSC1EPNS_15BaseTypeFactoryERKSs

@alando46 - I updated the docker image again today, mind trying the most current version?