Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDAL import error #213

Closed
emthompson-usgs opened this issue Jul 24, 2018 · 1 comment
Closed

GDAL import error #213

emthompson-usgs opened this issue Jul 24, 2018 · 1 comment

Comments

@emthompson-usgs
Copy link

Issue:
The following import fails in linux:

In [1]: from osgeo import osr
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-f3ebf498af2a> in <module>()
----> 1 from osgeo import osr

~/miniconda/envs/gf/lib/python3.5/site-packages/osgeo/__init__.py in <module>()
     19                 fp.close()
     20             return _mod
---> 21     _gdal = swig_import_helper()
     22     del swig_import_helper
     23 else:

~/miniconda/envs/gf/lib/python3.5/site-packages/osgeo/__init__.py in swig_import_helper()
     15         if fp is not None:
     16             try:
---> 17                 _mod = imp.load_module('_gdal', fp, pathname, description)
     18             finally:
     19                 fp.close()

~/miniconda/envs/gf/lib/python3.5/imp.py in load_module(name, file, filename, details)
    241                 return load_dynamic(name, filename, opened_file)
    242         else:
--> 243             return load_dynamic(name, filename, file)
    244     elif type_ == PKG_DIRECTORY:
    245         return load_package(name, filename)

~/miniconda/envs/gf/lib/python3.5/imp.py in load_dynamic(name, path, file)
    341         spec = importlib.machinery.ModuleSpec(
    342             name=name, loader=loader, origin=path)
--> 343         return _load(spec)
    344
    345 else:

ImportError: /home/emthompson/miniconda/envs/gf/lib/python3.5/site-packages/osgeo/../../../libgdal.so.20: undefined symbol: _ZN9kmlengine4Href5ParseERKSs

It took a while to identify this as the problem because it does not occur in OSX (same version of gdal), which is what I use for development. It originally showed up as a segmentation fault on Travis CI with pytest. I can provide that info if it would be helpful. The same unit tests with the same install scripts were passing on Travis yesterday.


Environment (conda list):
$ conda list
# packages in environment at /home/emthompson/miniconda/envs/gf:
#
# Name                    Version                   Build  Channel
affine                    2.2.1                      py_0    conda-forge
alabaster                 0.7.11                     py_3    conda-forge
altair                    2.1.0                      py_0    conda-forge
asn1crypto                0.24.0                     py_1    conda-forge
atomicwrites              1.1.5                    py35_0    conda-forge
attrs                     18.1.0                     py_1    conda-forge
babel                     2.6.0                      py_1    conda-forge
backcall                  0.1.0                      py_0    conda-forge
basemap                   1.1.0                    py35_4    conda-forge
basemap-data-hires        1.1.0                         0    conda-forge
bcrypt                    3.1.4            py35ha35c455_0
beautifulsoup4            4.6.0                    py35_0    conda-forge
blas                      1.0                         mkl
blinker                   1.4                        py_1    conda-forge
blosc                     1.14.0               hfc679d8_1    conda-forge
boost                     1.66.0                   py35_1    conda-forge
boost-cpp                 1.66.0                        1    conda-forge
boto3                     1.7.61                     py_0    conda-forge
botocore                  1.10.61                    py_0    conda-forge
branca                    0.3.0                      py_0    conda-forge
bzip2                     1.0.6                h470a237_2    conda-forge
ca-certificates           2018.4.16                     0    conda-forge
cairo                     1.14.10                       0    conda-forge
cartopy                   0.16.0                   py35_0    conda-forge
certifi                   2018.4.16                py35_0    conda-forge
cffi                      1.11.5                   py35_0    conda-forge
chardet                   3.0.4                    py35_2    conda-forge
click                     6.7                        py_1    conda-forge
click-plugins             1.0.3                      py_1    conda-forge
cligj                     0.4.0                    py35_0    conda-forge
cloudpickle               0.5.3                      py_0    conda-forge
configobj                 5.0.6                    py35_0
coverage                  4.5.1            py35h470a237_1    conda-forge
cryptography              2.3              py35hdffb7b8_0    conda-forge
cryptography-vectors      2.3                      py35_0    conda-forge
curl                      7.60.0                        0    conda-forge
cycler                    0.10.0                     py_1    conda-forge
dask-core                 0.18.2                     py_0    conda-forge
dbus                      1.13.0               h3a4f0e9_0    conda-forge
decorator                 4.3.0                      py_0    conda-forge
descartes                 1.1.0                      py_1    conda-forge
docutils                  0.14                     py35_0    conda-forge
entrypoints               0.2.3                    py35_1    conda-forge
et_xmlfile                1.0.1                    py35_0    conda-forge
expat                     2.2.5                hfc679d8_1    conda-forge
feedgenerator             1.9                        py_1    conda-forge
fiona                     1.7.13                   py35_0    conda-forge
folium                    0.5.0                      py_0    conda-forge
fontconfig                2.12.6                        0    conda-forge
freetype                  2.8.1                         0    conda-forge
freexl                    1.0.5                hf837533_1    conda-forge
future                    0.16.0                   py35_2    conda-forge
gdal                      2.2.4                    py35_0    conda-forge
geos                      3.6.2                hfc679d8_2    conda-forge
geotiff                   1.4.2                hb54a4aa_2    conda-forge
gettext                   0.19.8.1                      0    conda-forge
ghp-import                0.5.5                      py_1    conda-forge
giflib                    5.1.4                h470a237_0    conda-forge
glib                      2.55.0                        0    conda-forge
groundfailure             0.1.dev0                  <pip>
gst-plugins-base          1.8.0                         0    conda-forge
gstreamer                 1.8.0                         1    conda-forge
h5py                      2.8.0            py35h470a237_0    conda-forge
hdf4                      4.2.13                        0    conda-forge
hdf5                      1.10.1                        2    conda-forge
icu                       58.2                 hfc679d8_0    conda-forge
idna                      2.7                      py35_2    conda-forge
imageio                   2.3.0                      py_1    conda-forge
imagesize                 1.0.0                      py_1    conda-forge
impactutils               0.8.6                         1    conda-forge
intel-openmp              2018.0.3                      0
ipython                   6.4.0                    py35_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
jdcal                     1.4                        py_1    conda-forge
jedi                      0.12.1                   py35_0    conda-forge
jinja2                    2.10                       py_1    conda-forge
jmespath                  0.9.3                      py_1    conda-forge
jpeg                      9c                   h470a237_0    conda-forge
json-c                    0.12.1                        0    conda-forge
jsonschema                2.6.0                    py35_1    conda-forge
kealib                    1.4.7                         4    conda-forge
kiwisolver                1.0.1                    py35_1    conda-forge
krb5                      1.14.6                        0    conda-forge
libboost                  1.65.1               habcd387_4
libcomcat                 1.2.4                    py35_0    conda-forge
libdap4                   3.18.3                        2    conda-forge
libffi                    3.2.1                         3    conda-forge
libgcc-ng                 7.2.0                hdf63c60_3
libgdal                   2.2.4                         5    conda-forge
libgfortran               3.0.0                         1
libgfortran-ng            7.2.0                hdf63c60_3
libiconv                  1.15                 h470a237_1    conda-forge
libkml                    1.3.0                h9d32c78_3
libnetcdf                 4.6.1                         2    conda-forge
libpng                    1.6.34               ha92aebf_1    conda-forge
libpq                     9.6.3                         0    conda-forge
libspatialite             4.3.0a                       19    conda-forge
libssh2                   1.8.0                h5b517e9_2    conda-forge
libstdcxx-ng              7.2.0                hdf63c60_3
libtiff                   4.0.9                he6b73bb_1    conda-forge
libxcb                    1.13                 h470a237_2    conda-forge
libxml2                   2.9.8                h422b904_2    conda-forge
libxslt                   1.1.32               h88dbc4e_1    conda-forge
lxml                      4.2.3            py35hc9114bc_0    conda-forge
lzo                       2.10                          0    conda-forge
mapio                     0.7.10                     py_0    conda-forge
markdown                  2.6.11                     py_0    conda-forge
markupsafe                1.0                      py35_0    conda-forge
matplotlib                2.2.2                    py35_1    conda-forge
mkl                       2018.0.3                      1
mkl_fft                   1.0.4                    py35_0    conda-forge
mkl_random                1.0.1                    py35_0    conda-forge
more-itertools            4.2.0                    py35_1    conda-forge
munch                     2.3.2                      py_0    conda-forge
ncurses                   5.9                          10    conda-forge
networkx                  2.1                        py_1    conda-forge
nose                      1.3.7                    py35_2    conda-forge
numexpr                   2.6.5                    py35_0    conda-forge
numpy                     1.14.5           py35hcd700cb_0
numpy-base                1.14.5           py35hdbf6ddf_0
obspy                     1.1.0                    py35_1    conda-forge
olefile                   0.45.1                     py_1    conda-forge
openblas                  0.2.20                        8    conda-forge
openjpeg                  2.3.0                h0e734dc_3    conda-forge
openpyxl                  2.5.4                      py_1    conda-forge
openssl                   1.0.2o                        0    conda-forge
owslib                    0.16.0                     py_0    conda-forge
packaging                 17.1                       py_0    conda-forge
pandas                    0.23.3                   py35_0    conda-forge
paramiko                  2.4.1                    py35_0    conda-forge
parso                     0.3.0                      py_0    conda-forge
pcre                      8.41                          1    conda-forge
pelican                   3.7.1                      py_1    conda-forge
pexpect                   4.6.0                    py35_0    conda-forge
pickleshare               0.7.4                    py35_0    conda-forge
pillow                    5.2.0                    py35_0    conda-forge
pip                       18.0                      <pip>
pip                       10.0.1                   py35_0    conda-forge
pixman                    0.34.0                        2    conda-forge
pluggy                    0.6.0                      py_0    conda-forge
pockets                   0.6.2                     <pip>
poppler                   0.61.1                        3    conda-forge
poppler-data              0.4.9                         0    conda-forge
proj4                     4.9.3                         5    conda-forge
prompt_toolkit            1.0.15                   py35_0    conda-forge
pthread-stubs             0.4                  h470a237_1    conda-forge
ptyprocess                0.6.0                    py35_0    conda-forge
py                        1.5.4                      py_0    conda-forge
pyasn1                    0.4.3                      py_0    conda-forge
pycparser                 2.18                       py_1    conda-forge
pycrypto                  2.6.1                    py35_1    conda-forge
pyepsg                    0.3.2                      py_1    conda-forge
pygments                  2.2.0                      py_1    conda-forge
pynacl                    1.1.2                    py35_0    conda-forge
pyopenssl                 18.0.0                   py35_0    conda-forge
pyparsing                 2.2.0                      py_1    conda-forge
pyproj                    1.9.5.1                  py35_0    conda-forge
pyqt                      5.6.0            py35h8210e8a_6    conda-forge
pyshp                     1.2.12                     py_0    conda-forge
pysocks                   1.6.8                    py35_1    conda-forge
pytables                  3.4.4                    py35_8    conda-forge
pytest                    3.6.3                    py35_0    conda-forge
pytest-cov                2.5.1                      py_1    conda-forge
pytest-faulthandler       1.5.0                    py35_0    conda-forge
pytest-mpl                0.9                        py_0    conda-forge
python                    3.5.5                         1    conda-forge
python-dateutil           2.7.3                      py_0    conda-forge
pytz                      2018.5                     py_0    conda-forge
pywavelets                0.5.2                    py35_1    conda-forge
pyyaml                    3.12                     py35_1    conda-forge
qt                        5.6.2                         7    conda-forge
rasterio                  1.0.0            py35h1b5fcde_0    conda-forge
readline                  7.0                           0    conda-forge
requests                  2.19.1                   py35_1    conda-forge
s3transfer                0.1.13                   py35_0    conda-forge
scikit-image              0.14.0           py35hfc679d8_1    conda-forge
scikit-learn              0.19.1           py35hbf1f462_0
scipy                     1.1.0            py35hfc37229_0
setuptools                40.0.0                   py35_0    conda-forge
shapely                   1.6.4            py35h164cb2d_1    conda-forge
simplegeneric             0.8.1                      py_1    conda-forge
sip                       4.18                     py35_1    conda-forge
six                       1.11.0                   py35_1    conda-forge
snowballstemmer           1.2.1                      py_1    conda-forge
snuggs                    1.4.1                      py_1    conda-forge
sphinx                    1.7.5                    py35_0    conda-forge
sphinx-argparse           0.2.2                     <pip>
sphinx-rtd-theme          0.4.0                     <pip>
sphinxcontrib-napoleon    0.6.1                     <pip>
sphinxcontrib-websupport  1.0.1                    py35_0    conda-forge
sqlalchemy                1.2.10                   py35_0    conda-forge
sqlite                    3.20.1                        2    conda-forge
tk                        8.6.8                         0    conda-forge
toolz                     0.9.0                      py_0    conda-forge
tornado                   5.1                      py35_0    conda-forge
traitlets                 4.3.2                    py35_0    conda-forge
typing                    3.6.4                    py35_2    conda-forge
unidecode                 1.0.22                     py_1    conda-forge
urllib3                   1.23                     py35_0    conda-forge
util-linux                2.21                          0
vincent                   0.4.4                      py_1    conda-forge
wcwidth                   0.1.7                      py_1    conda-forge
wheel                     0.31.1                   py35_0    conda-forge
xerces-c                  3.2.0                         0    conda-forge
xlrd                      1.1.0                      py_2    conda-forge
xlsxwriter                1.0.5                      py_0    conda-forge
xlwt                      1.3.0                      py_1    conda-forge
xorg-libxau               1.0.8                h470a237_6    conda-forge
xorg-libxdmcp             1.1.2                h470a237_7    conda-forge
xz                        5.2.3                         0    conda-forge
yaml                      0.1.7                         0    conda-forge
zlib                      1.2.11               h470a237_3    conda-forge

Details about conda and system ( conda info ):
$ conda info

     active environment : gf
    active env location : /home/emthompson/miniconda/envs/gf
            shell level : 1
       user config file : /home/emthompson/.condarc
 populated config files : /home/emthompson/.condarc
          conda version : 4.5.4
    conda-build version : not installed
         python version : 3.6.5.final.0
       base environment : /home/emthompson/miniconda  (writable)
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/linux-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/linux-64
                          https://repo.anaconda.com/pkgs/pro/noarch
          package cache : /home/emthompson/miniconda/pkgs
                          /home/emthompson/.conda/pkgs
       envs directories : /home/emthompson/miniconda/envs
                          /home/emthompson/.conda/envs
               platform : linux-64
             user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.5 Linux/3.10.0-862.6.3.el7.x86_64 rhel/7.5 glibc/2.17
                UID:GID : 176539137:176539137
             netrc file : None
           offline mode : False
@ocefpaf
Copy link
Member

ocefpaf commented Jul 24, 2018

I see a mixture of packages from defaults and conda-forge there. Please take a look at https://conda-forge.org/docs/conda-forge_gotchas.html

To confirm that everything works you can try:

conda create --name GDAL python=3.5 gdal --channel conda-forge --yes
conda activate GDAL
python -c 'from osgeo import osr; print(dir(osr))'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants