1

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.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Dec 10, 2018 at 9:23

2 Answers 2

2

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
answered Jan 22, 2019 at 11:55
1

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
answered Dec 11, 2018 at 10:47

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.