conda-forge / gdal-feedstock

A conda-smithy repository for gdal.
BSD 3-Clause "New" or "Revised" License
30 stars 63 forks source link

gdal ImportError with libkea undefined symbol #201

Closed Lupin76 closed 6 years ago

Lupin76 commented 6 years ago

I get this error message when I try to import gdal in Spyder installed via Anaconda.

ImportError: /home/giacomo/anaconda2/lib/python2.7/site-packages/osgeo/../../.././libkea.so.1.4: undefined symbol: _ZN2H56H5FileC1ERKSsjRKNS_17FileCreatPropListERKNS_15FileAccPropListE

You can find in attach what comes out from TEST, conda list and conda info.

(TEST) giacomo@giacomo-K73SV:~$ python -c "from osgeo import gdal; print(dir(gdal))"
['AllRegister', 'ApplyGeoTransform', 'ApplyVerticalShiftGrid', 'AsyncReader', 'AsyncReader_swigregister', 'AutoCreateWarpedVRT', 'Band', 'Band_swigregister', 'BuildVRT', 'BuildVRTInternalNames', 'BuildVRTInternalObjects', 'BuildVRTOptions', 'CE_Debug', 'CE_Failure', 'CE_Fatal', 'CE_None', 'CE_Warning', 'CPLBinaryToHex', 'CPLES_BackslashQuotable', 'CPLES_CSV', 'CPLES_SQL', 'CPLES_URL', 'CPLES_XML', 'CPLE_AppDefined', 'CPLE_AssertionFailed', 'CPLE_FileIO', 'CPLE_IllegalArg', 'CPLE_NoWriteAccess', 'CPLE_None', 'CPLE_NotSupported', 'CPLE_OpenFailed', 'CPLE_OutOfMemory', 'CPLE_UserInterrupt', 'CPLHexToBinary', 'CXT_Attribute', 'CXT_Comment', 'CXT_Element', 'CXT_Literal', 'CXT_Text', 'ColorEntry', 'ColorEntry_swigregister', 'ColorTable', 'ColorTable_swigregister', 'ComputeMedianCutPCT', 'ComputeProximity', 'ContourGenerate', 'CreatePansharpenedVRT', 'DCAP_CREATE', 'DCAP_CREATECOPY', 'DCAP_DEFAULT_FIELDS', 'DCAP_NOTNULL_FIELDS', 'DCAP_NOTNULL_GEOMFIELDS', 'DCAP_OPEN', 'DCAP_RASTER', 'DCAP_VECTOR', 'DCAP_VIRTUALIO', 'DEMProcessing', 'DEMProcessingInternal', 'DEMProcessingOptions', 'DMD_CONNECTION_PREFIX', 'DMD_CREATIONDATATYPES', 'DMD_CREATIONFIELDDATATYPES', 'DMD_CREATIONOPTIONLIST', 'DMD_EXTENSION', 'DMD_EXTENSIONS', 'DMD_HELPTOPIC', 'DMD_LONGNAME', 'DMD_MIMETYPE', 'DMD_SUBDATASETS', 'DataTypeIsComplex', 'Dataset', 'Dataset_swigregister', 'Debug', 'DecToDMS', 'DecToPackedDMS', 'DitherRGB2PCT', 'DontUseExceptions', 'Driver', 'Driver_swigregister', 'Error', 'ErrorReset', 'EscapeString', 'FPolygonize', 'FileFromMemBuffer', 'FillNodata', 'FindFile', 'FinderClean', 'GARIO_COMPLETE', 'GARIO_ERROR', 'GARIO_PENDING', 'GARIO_UPDATE', 'GA_ReadOnly', 'GA_Update', 'GCI_AlphaBand', 'GCI_BlackBand', 'GCI_BlueBand', 'GCI_CyanBand', 'GCI_GrayIndex', 'GCI_GreenBand', 'GCI_HueBand', 'GCI_LightnessBand', 'GCI_MagentaBand', 'GCI_PaletteIndex', 'GCI_RedBand', 'GCI_SaturationBand', 'GCI_Undefined', 'GCI_YCbCr_CbBand', 'GCI_YCbCr_CrBand', 'GCI_YCbCr_YBand', 'GCI_YellowBand', 'GCP', 'GCP_swigregister', 'GCPsToGeoTransform', 'GDALBuildVRTOptions', 'GDALBuildVRTOptions_swigregister', 'GDALDEMProcessingOptions', 'GDALDEMProcessingOptions_swigregister', 'GDALDestroyDriverManager', 'GDALGridOptions', 'GDALGridOptions_swigregister', 'GDALInfoOptions', 'GDALInfoOptions_swigregister', 'GDALNearblackOptions', 'GDALNearblackOptions_swigregister', 'GDALRasterizeOptions', 'GDALRasterizeOptions_swigregister', 'GDALTranslateOptions', 'GDALTranslateOptions_swigregister', 'GDALVectorTranslateOptions', 'GDALVectorTranslateOptions_swigregister', 'GDALWarpAppOptions', 'GDALWarpAppOptions_swigregister', 'GDAL_DATA_COVERAGE_STATUS_DATA', 'GDAL_DATA_COVERAGE_STATUS_EMPTY', 'GDAL_DATA_COVERAGE_STATUS_UNIMPLEMENTED', 'GDAL_GCP_GCPLine_get', 'GDAL_GCP_GCPLine_set', 'GDAL_GCP_GCPPixel_get', 'GDAL_GCP_GCPPixel_set', 'GDAL_GCP_GCPX_get', 'GDAL_GCP_GCPX_set', 'GDAL_GCP_GCPY_get', 'GDAL_GCP_GCPY_set', 'GDAL_GCP_GCPZ_get', 'GDAL_GCP_GCPZ_set', 'GDAL_GCP_Id_get', 'GDAL_GCP_Id_set', 'GDAL_GCP_Info_get', 'GDAL_GCP_Info_set', 'GDT_Byte', 'GDT_CFloat32', 'GDT_CFloat64', 'GDT_CInt16', 'GDT_CInt32', 'GDT_Float32', 'GDT_Float64', 'GDT_Int16', 'GDT_Int32', 'GDT_TypeCount', 'GDT_UInt16', 'GDT_UInt32', 'GDT_Unknown', 'GFT_Integer', 'GFT_Real', 'GFT_String', 'GFU_Alpha', 'GFU_AlphaMax', 'GFU_AlphaMin', 'GFU_Blue', 'GFU_BlueMax', 'GFU_BlueMin', 'GFU_Generic', 'GFU_Green', 'GFU_GreenMax', 'GFU_GreenMin', 'GFU_Max', 'GFU_MaxCount', 'GFU_Min', 'GFU_MinMax', 'GFU_Name', 'GFU_PixelCount', 'GFU_Red', 'GFU_RedMax', 'GFU_RedMin', 'GF_Read', 'GF_Write', 'GMF_ALL_VALID', 'GMF_ALPHA', 'GMF_NODATA', 'GMF_PER_DATASET', 'GOA2GetAccessToken', 'GOA2GetAuthorizationURL', 'GOA2GetRefreshToken', 'GPI_CMYK', 'GPI_Gray', 'GPI_HLS', 'GPI_RGB', 'GRA_Average', 'GRA_Bilinear', 'GRA_Cubic', 'GRA_CubicSpline', 'GRA_Lanczos', 'GRA_Max', 'GRA_Med', 'GRA_Min', 'GRA_Mode', 'GRA_NearestNeighbour', 'GRA_Q1', 'GRA_Q3', 'GRIORA_Average', 'GRIORA_Bilinear', 'GRIORA_Cubic', 'GRIORA_CubicSpline', 'GRIORA_Gauss', 'GRIORA_Lanczos', 'GRIORA_Mode', 'GRIORA_NearestNeighbour', 'GTO_BIT', 'GTO_BSQ', 'GTO_TIP', 'GeneralCmdLineProcessor', 'GetCacheMax', 'GetCacheUsed', 'GetColorInterpretationName', 'GetConfigOption', 'GetDataTypeByName', 'GetDataTypeName', 'GetDataTypeSize', 'GetDriver', 'GetDriverByName', 'GetDriverCount', 'GetJPEG2000Structure', 'GetJPEG2000StructureAsString', 'GetLastErrorMsg', 'GetLastErrorNo', 'GetLastErrorType', 'GetPaletteInterpretationName', 'GetUseExceptions', 'Grid', 'GridInternal', 'GridOptions', 'HasThreadSupport', 'IdentifyDriver', 'IdentifyDriverEx', 'Info', 'InfoInternal', 'InfoOptions', 'InvGeoTransform', 'MajorObject', 'MajorObject_swigregister', 'Mkdir', 'Nearblack', 'NearblackOptions', 'OF_ALL', 'OF_GNM', 'OF_RASTER', 'OF_READONLY', 'OF_SHARED', 'OF_UPDATE', 'OF_VECTOR', 'OF_VERBOSE_ERROR', 'Open', 'OpenEx', 'OpenShared', 'PackedDMSToDec', 'ParseCommandLine', 'ParseXMLString', 'Polygonize', 'PopErrorHandler', 'PopFinderLocation', 'PushErrorHandler', 'PushFinderLocation', 'RGBFile2PCTFile', 'RasterAttributeTable', 'RasterAttributeTable_swigregister', 'Rasterize', 'RasterizeLayer', 'RasterizeOptions', 'ReadDir', 'ReadDirRecursive', 'RegenerateOverview', 'RegenerateOverviews', 'Rename', 'ReprojectImage', 'Rmdir', 'SerializeXMLTree', 'SetCacheMax', 'SetConfigOption', 'SetErrorHandler', 'SieveFilter', 'StatBuf', 'StatBuf_swigregister', 'TermProgress', 'TermProgress_nocb', 'Transformer', 'Transformer_swigregister', 'Translate', 'TranslateInternal', 'TranslateOptions', 'Unlink', 'UseExceptions', 'VSICurlClearCache', 'VSIFCloseL', 'VSIFGetRangeStatusL', 'VSIFOpenExL', 'VSIFOpenL', 'VSIFReadL', 'VSIFSeekL', 'VSIFTellL', 'VSIFTruncateL', 'VSIFWriteL', 'VSIGetLastErrorMsg', 'VSIGetLastErrorNo', 'VSIStatL', 'VSISupportsSparseFiles', 'VSI_RANGE_STATUS_DATA', 'VSI_RANGE_STATUS_HOLE', 'VSI_RANGE_STATUS_UNKNOWN', 'VSI_STAT_EXISTS_FLAG', 'VSI_STAT_NATURE_FLAG', 'VSI_STAT_SIZE_FLAG', 'VectorTranslate', 'VectorTranslateOptions', 'VersionInfo', 'VirtualMem', 'VirtualMem_swigregister', 'Warp', 'WarpOptions', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__version__', '_gdal', '_is_str_or_unicode', '_newclass', '_object', '_swig_getattr', '_swig_getattr_nondynamic', '_swig_property', '_swig_repr', '_swig_setattr', '_swig_setattr_nondynamic', 'array_modes', 'byteorders', 'deprecation_warn', 'gdalconst', 'have_warned', 'ogr', 'osr', 'sys', 'wrapper_GDALNearblackDestDS', 'wrapper_GDALNearblackDestName', 'wrapper_GDALRasterizeDestDS', 'wrapper_GDALRasterizeDestName', 'wrapper_GDALVectorTranslateDestDS', 'wrapper_GDALVectorTranslateDestName', 'wrapper_GDALWarpDestDS', 'wrapper_GDALWarpDestName']
(TEST) giacomo@giacomo-K73SV:~$ conda list
# packages in environment at /home/giacomo/anaconda2/envs/TEST:
#
boost                     1.66.0                   py27_1    conda-forge
boost-cpp                 1.66.0                        1    conda-forge
bzip2                     1.0.6                         1    conda-forge
ca-certificates           2018.1.18                     0    conda-forge
cairo                     1.14.10                       0    conda-forge
certifi                   2018.1.18                py27_0    conda-forge
curl                      7.55.1                        0    conda-forge
expat                     2.2.5                         0    conda-forge
fontconfig                2.12.6                        0    conda-forge
freetype                  2.8.1                         0    conda-forge
freexl                    1.0.4                         0    conda-forge
gdal                      2.2.3                    py27_0    conda-forge
geos                      3.6.2                         1    conda-forge
geotiff                   1.4.2                         1    conda-forge
gettext                   0.19.8.1                      0    conda-forge
giflib                    5.1.4                         0    conda-forge
glib                      2.55.0                        0    conda-forge
hdf4                      4.2.13                        0    conda-forge
hdf5                      1.10.1                        2    conda-forge
icu                       58.2                          0    conda-forge
intel-openmp              2018.0.0             hc7b2577_8  
jpeg                      9b                            2    conda-forge
json-c                    0.12.1                        0    conda-forge
kealib                    1.4.7                         4    conda-forge
krb5                      1.14.2                        0    conda-forge
libdap4                   3.18.3                        2    conda-forge
libffi                    3.2.1                         3    conda-forge
libgcc-ng                 7.2.0                h7cc24e2_2  
libgdal                   2.2.3                         3    conda-forge
libgfortran               3.0.0                         1  
libgfortran-ng            7.2.0                h9f7466a_2  
libiconv                  1.15                          0    conda-forge
libkml                    1.3.0                         6    conda-forge
libnetcdf                 4.4.1.1                      10    conda-forge
libpng                    1.6.34                        0    conda-forge
libpq                     9.6.3                         0    conda-forge
libspatialite             4.3.0a                       19    conda-forge
libssh2                   1.8.0                         2    conda-forge
libtiff                   4.0.9                         0    conda-forge
libxml2                   2.9.7                         0    conda-forge
mkl                       2018.0.1             h19d6760_4  
ncurses                   5.9                          10    conda-forge
numpy                     1.14.1           py27h3dfced4_1  
openjpeg                  2.3.0                         2    conda-forge
openssl                   1.0.2n                        0    conda-forge
pcre                      8.39                          0    conda-forge
pip                       9.0.1                    py27_1    conda-forge
pixman                    0.34.0                        1    conda-forge
poppler                   0.61.1                        3    conda-forge
poppler-data              0.4.8                         0    conda-forge
proj4                     4.9.3                         5    conda-forge
python                    2.7.14                        4    conda-forge
readline                  7.0                           0    conda-forge
setuptools                38.5.1                   py27_0    conda-forge
sqlite                    3.20.1                        2    conda-forge
tk                        8.6.7                         0    conda-forge
util-linux                2.21                          0  
wheel                     0.30.0                   py27_2    conda-forge
xerces-c                  3.2.0                         0    conda-forge
xz                        5.2.3                         0    conda-forge
zlib                      1.2.11                        0    conda-forge
(TEST) giacomo@giacomo-K73SV:~$ conda info
Current conda install:

               platform : linux-64
          conda version : 4.3.34
       conda is private : False
      conda-env version : 4.3.34
    conda-build version : 3.5.1
         python version : 2.7.14.final.0
       requests version : 2.18.4
       root environment : /home/giacomo/anaconda2  (writable)
    default environment : /home/giacomo/anaconda2/envs/TEST
       envs directories : /home/giacomo/anaconda2/envs
                          /home/giacomo/.conda/envs
          package cache : /home/giacomo/anaconda2/pkgs
                          /home/giacomo/.conda/pkgs
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.continuum.io/pkgs/main/linux-64
                          https://repo.continuum.io/pkgs/main/noarch
                          https://repo.continuum.io/pkgs/free/linux-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/linux-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/linux-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : /home/giacomo/.condarc
             netrc file : None
           offline mode : False
             user-agent : conda/4.3.34 requests/2.18.4 CPython/2.7.14 Linux/4.4.0-112-generic debian/stretch/sid glibc/2.23    
                UID:GID : 1000:1000

I installed it just today thus I'm brand new with this environment. Any help is welcome. Thank you

kmuehlbauer commented 6 years ago

@Lupin76 You are using gdal within conda root-env. This is not recommended. See also this comment.

Lupin76 commented 6 years ago

Hi thank you very much for your help. As I told you I'm brand new with anaconda. Moving from root-env means uninstall and re-install anaconda again?

Thank you again

ocefpaf commented 6 years ago

Moving from root-env means uninstall and re-install anaconda again?

No need to re-install. Please take a look at

https://conda.io/docs/user-guide/tasks/manage-environments.html

to learn more about conda environments and

https://conda-forge.org/docs/conda-forge_gotchas.html#using-multiple-channels

to understand more about the issue of mixing conda channels.

Lupin76 commented 6 years ago

Ok. You are really very helpful.

Thank you very much

Lupin76 commented 6 years ago

Just the last question.

Before creating a new environment and installing GDAL in, do I have to uninstall GDAL from the root-env? How to do it?

Thank you

ocefpaf commented 6 years ago

Before creating a new environment and installing GDAL in, do I have to uninstall GDAL from the root-env? How to do it?

It should not affect the new environment, but it is not working... So that is your call.

Lupin76 commented 6 years ago

Ok. Thank you again

DennisScuba commented 6 years ago

Hello, I'm new to Python and have basically the same problem only with liblibkea:

ImportError: /home/mattes/anaconda3/lib/python3.6/site-packages/osgeo/../../.././libkea.so.1.4: undefined symbol: _ZN2H56H5FileC1ERKSsjRKNS_17FileCreatPropListERKNS_15FileAccPropListE

I tried to create a new environment like the following description: http://www.gmtpython.xyz/install.html#installing-gmt-and-other-dependencies

But sadly it still doesn't work.

The output of the conda list is the following:

# packages in environment at /home/mattes/anaconda3/envs/gmt-python:
#
# Name                    Version                   Build  Channel
blas                      1.1                    openblas    conda-forge
bokeh                     0.12.16                  py36_0    conda-forge
boost                     1.66.0                   py36_1    conda-forge
boost-cpp                 1.66.0                        1    conda-forge
bottleneck                1.2.1                    py36_1    conda-forge
bzip2                     1.0.6                         1    conda-forge
ca-certificates           2018.4.16                     0    conda-forge
cairo                     1.14.10                       0    conda-forge
certifi                   2018.4.16                py36_0    conda-forge
cftime                    1.0.0                    py36_0    conda-forge
click                     6.7                        py_1    conda-forge
cloudpickle               0.5.3                      py_0    conda-forge
curl                      7.60.0                        0    conda-forge
cytoolz                   0.9.0.1                  py36_0    conda-forge
dask                      0.17.5                     py_0    conda-forge
dask-core                 0.17.5                     py_0    conda-forge
dcw-gmt                   1.1.3                         0    conda-forge
distributed               1.21.8                   py36_0    conda-forge
expat                     2.2.5                         0    conda-forge
fftw                      3.3.7                         0    conda-forge
fontconfig                2.12.6                        0    conda-forge
freetype                  2.8.1                         0    conda-forge
freexl                    1.0.5                         0    conda-forge
gdal                      2.2.4                    py36_0    conda-forge
geos                      3.6.2                         1    conda-forge
geotiff                   1.4.2                         1    conda-forge
gettext                   0.19.8.1                      0    conda-forge
ghostscript               9.22                          0    conda-forge
giflib                    5.1.4                         0    conda-forge
glib                      2.55.0                        0    conda-forge
gmt                       6.0.0a14        blas_openblas_202  [blas_openblas]  conda-forge/label/dev
gmt-python                0+unknown                 <pip>
gshhg-gmt                 2.3.7                         0    conda-forge
h5netcdf                  0.5.1                      py_0    conda-forge
h5py                      2.8.0            py36h470a237_0    conda-forge
hdf4                      4.2.13                        0    conda-forge
hdf5                      1.10.1                        2    conda-forge
heapdict                  1.0.0                    py36_0    conda-forge
icu                       58.2                          0    conda-forge
jinja2                    2.10                     py36_0    conda-forge
jpeg                      9b                            2    conda-forge
json-c                    0.12.1                        0    conda-forge
kealib                    1.4.7                         4    conda-forge
krb5                      1.14.6                        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                         2    conda-forge
libgfortran               3.0.0                         1  
libiconv                  1.15                          0    conda-forge
libkml                    1.3.0                         6    conda-forge
libnetcdf                 4.6.1                         2    conda-forge
libpng                    1.6.34                        0    conda-forge
libpq                     9.6.3                         0    conda-forge
libspatialite             4.3.0a                       19    conda-forge
libssh2                   1.8.0                         2    conda-forge
libstdcxx-ng              7.2.0                hdf63c60_3  
libtiff                   4.0.9                         0    conda-forge
libxml2                   2.9.8                         0    conda-forge
locket                    0.2.0                    py36_1    conda-forge
markupsafe                1.0                      py36_0    conda-forge
msgpack-python            0.5.6            py36h2d50403_2    conda-forge
ncurses                   5.9                          10    conda-forge
netcdf4                   1.4.0                    py36_0    conda-forge
numpy                     1.14.3          py36_blas_openblas_200  [blas_openblas]  conda-forge
openblas                  0.2.20                        8    conda-forge
openjpeg                  2.3.0                         2    conda-forge
openssl                   1.0.2o                        0    conda-forge
packaging                 17.1                       py_0    conda-forge
pandas                    0.23.0                   py36_1    conda-forge
partd                     0.3.8                    py36_0    conda-forge
pcre                      8.41                          1    conda-forge
pip                       9.0.3                    py36_0    conda-forge
pixman                    0.34.0                        2    conda-forge
poppler                   0.61.1                        3    conda-forge
poppler-data              0.4.9                         0    conda-forge
proj4                     4.9.3                         5    conda-forge
psutil                    5.4.5                    py36_0    conda-forge
pyparsing                 2.2.0                    py36_0    conda-forge
python                    3.6.5                         1    conda-forge
python-dateutil           2.7.3                      py_0    conda-forge
pytz                      2018.4                     py_0    conda-forge
pyyaml                    3.12                     py36_1    conda-forge
readline                  7.0                           0    conda-forge
scipy                     1.1.0           py36_blas_openblas_200  [blas_openblas]  conda-forge
setuptools                39.2.0                   py36_0    conda-forge
six                       1.11.0                   py36_1    conda-forge
sortedcontainers          2.0.2                    py36_0    conda-forge
sqlite                    3.20.1                        2    conda-forge
tblib                     1.3.2                    py36_0    conda-forge
tk                        8.6.7                         0    conda-forge
toolz                     0.9.0                      py_0    conda-forge
tornado                   5.0.2                    py36_0    conda-forge
util-linux                2.21                          0  
wheel                     0.31.0                   py36_0    conda-forge
xarray                    0.10.4                   py36_0    conda-forge
xerces-c                  3.2.0                         0    conda-forge
xz                        5.2.3                         0    conda-forge
yaml                      0.1.7                         0    conda-forge
zict                      0.1.3                      py_0    conda-forge
zlib                      1.2.11               h470a237_2    conda-forge

Does someone has an idea? Thank you very much in advance!

ocefpaf commented 6 years ago

Please read https://conda-forge.org/docs/conda-forge_gotchas.html#using-multiple-channels first!

You are getting gdal from conda-forge and libgdal from defaults. That won't work! You will need to put the conda-forge on top of defaults in your .condarc and install things in an isolated env. I cannot say anything about the instructions your are following (I would ask there), but this works:

conda create -n GDAL python=3.6 gdal
conda activate GDAL
python -c 'import gdal; print(dir(gdal))'
DennisScuba commented 6 years ago

Thank you very much! I could solve the problem.