0

When installing GDAL via Conda, install fails, on OSX Mojave and Python 3.7:

dlopen(/Users/tomkom/anaconda3/lib/python3.7/site-packages/osgeo/_gdal.cpython-37m-darwin.so, 2): Library not loaded: @rpath/libfontconfig.1.dylib
  Referenced from: /Users/tomkom/anaconda3/lib/libpoppler.78.dylib
  Reason: Incompatible library version: libpoppler.78.dylib requires version 14.0.0 or later, but libfontconfig.1.dylib provides version 13.0.0

I am unable to locate the cause. Installed using:

 conda install -c conda-forge gdal

As per standard.

The error seems to indicate issues with libpoppler and a font library (libfontconfig). I am unsure about the role of these libraries and how to update them.

  • i recommend installing your gis stack into a new environment: e.g., conda create --name=gis python=3.6 gdal geopandas rasterio ipykernel --channel=conda-forge – Paul H Mar 26 at 22:17
  • @PaulH Any suggestion why forcing python to a lower version? Mine is 3.7. I would need to install an older one... Also, why ipykernel? – MartinT Mar 26 at 22:52
  • 1
    Lower version: I'm not sure e.g. geopandas and rasterio are available on python 3.7 yet. Even if they are available for Python 3.7, since so much of the GIS stack is written in C, compiled, and linked together, it's definitely better to install everything at the same time, and from a single channel (I prefer conda-forge). You need the ipykernel to let the environment talk to whatever jupyer notebook or jupyter lab server you have running, if you have one running, which I recommend you do. – Paul H Mar 26 at 23:05
  • 1
    I just did a quick conda search for gdal and geopandas and python 3.7 builds are available. pick which ever python you want, but use a fresh environment in either case. – Paul H Mar 26 at 23:13
  • Thanks for the hints. A clean environment helped with a different downstream issue, yet standalone GDAL still has issues with the fonts. This is what I am waiting for as an answer - clarification why fonts should be a problem, how to resolve this issue, and why this happens now on Mojave, not before. – MartinT Apr 1 at 2:27
0

Got this error too when all my GIS related packages (geopandas, gdal, fiona) that all seem to rely on that libfontconfig randomnly broke.

In terminal, I had to first install the fontconfig package using brew

brew install fontconfig

Navigate to your python install path, which is in your error:

cd /Users/tomkom/anaconda3/lib/

Rename the libfontconfig to a backup version

mv libfontconfig.1.dylib libfontconfig.1.dylib.bak

Create a symbolic link from your python library to where the fontconfig library is installed in step 1

ln -s /usr/local/lib/libfontconfig.1.dylib .

Check your python version of libfontconfig is now up to date

otool -L libfontconfig.1.dylib

Mine says /usr/local/opt/fontconfig/lib/libfontconfig.1.dylib (compatibility version 14.0.0, current version 14.0.0)

-1

Maybe this tutorial may help you.

https://hackernoon.com/install-python-gdal-using-conda-on-mac-8f320ca36d90

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • 2
    Links rot. Therefore you should summarize what's in the link. Otherwise this is a low quality answer and should be a comment. – Paul H Mar 26 at 23:04

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.