2

I'm trying to install gdal on my new computer in the anaconda environment using conda but having issues. All I've done so far is install Anaconda for python 3.6 and install gdal as described here + a few other libraries using both conda and pip.

Trouble is when I try to run from "osgeo import gdal" the iPython console in spyder I get this error, which I'm not smart enough to interpret on my own:

Traceback (most recent call last):

File "", line 1, in from osgeo import gdal

File "/anaconda/lib/python3.6/site-packages/osgeo/init.py", line 21, in _gdal = swig_import_helper()

File "/anaconda/lib/python3.6/site-packages/osgeo/init.py", line 17, in swig_import_helper _mod = imp.load_module('_gdal', fp, pathname, description)

File "/anaconda/lib/python3.6/imp.py", line 242, in load_module return load_dynamic(name, filename, file)

File "/anaconda/lib/python3.6/imp.py", line 342, in load_dynamic return _load(spec)

ImportError: dlopen(/anaconda/lib/python3.6/site->>>>packages/osgeo/_gdal.cpython-36m-darwin.so, 2): Library not loaded: >>>>@rpath/libicui18n.58.dylib Referenced from: /anaconda/lib/libgdal.20.dylib Reason: image not found

Is there a problem with the conda install of gdal I'm using, or am I missing a piece?

Is there a different/easier way to start using gdal than this?

  • Anaconda has gdal 2.10 included. Is there a reason to install a version from the conda-forge channel? – Kersten Aug 14 '17 at 8:56
  • Oh, if that's the case I've been mislead. I was under the impression Anaconda stopped including GDAL a long time ago and i'd need to install it on my own. Perhaps installing the conda-forge version broke things. – AlexGilvarry Aug 14 '17 at 19:43
  • I re-installed macOS and anaconda on my MacBook and tried to install goal from the Anaconda channel but it wouldn't install. Instead I got this: UnsatisfiableError: The following specifications were found to be in conflict: - gdal -> numpy 1.8* -> python 2.6* -> openssl 1.0.1* - python 3.6* Use "conda info <package>" to see the dependencies for each package. – AlexGilvarry Aug 14 '17 at 21:01
  • I have to revise my comment. The link states GDAL is available for Linux/Mac with Python3.6 but not included in the installer. My bad. – Kersten Aug 15 '17 at 13:36
  • The gdal package is available on conda but it basically never works on MacOS. – Adam Erickson Jun 26 '18 at 2:14
0

I've found that the dependency versions are a bit messed up. GDAL is relying on there being older versions of certain libraries, but newer ones are installed by default. I've managed to get it working by forcing older versions of some of the dependencies. A minimal working environment.yml looks like this:

name: gis_project
channels:
  - conda-forge
  - defaults
dependencies:
  - gdal=2.3.1
  - ncurses=5.9=10
  - libspatialite=4.3.0a=19

In a new directory, run conda env create, activate the environment conda activate gis_project and check it works.

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.