0

I'm attempting to import gdal in Python 3.6 and I receive the error below.

ImportError: dlopen(/anaconda3/lib/python3.6/site-packages/osgeo/_gdal.cpython-36m-darwin.so, 2): Symbol not found: __ZN11xercesc_3_211InputSource11setEncodingEPKt Referenced from: /anaconda3/lib/libgdal.20.dylib Expected in: /anaconda3/lib/libxerces-c-3.2.dylib in /anaconda3/lib/libgdal.20.dylib

I currently use anaconda. I've attempted uninstalling/reinstalling gdal and libgdal with "conda install 'module'" with no success.

Conda is automatically installing version 2.3.0 for gdal and libgdal.

1

You should ensure that all your packages if installed with conda are set to prioritize the conda-forge channel over defaults. You can set thus: conda config --add channels conda-forge. This creates the .condarc file if you don't have it already and puts conda-forge first. You can delete defaults from the .condarc file. Then do a conda update --all

if this doesn't work from your default environment, you can try doing it in a virtual environment created as follows:

conda create -n env python=3 anaconda #create virtual env (name:env)
conda activate env #activates virtual env
0

Try getting the .whl file for gdal from here:

https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal

Make sure to pick the correct version you need, e.g. cp36 and then the either the 32 or 64 bit distribution.

Once you have the correct file then try running

conda install GDAL_Whatever_Version_You_Have.whl

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.