upgraded libtiff is now causing error while starting django server

589 Views Asked by At

So I recently performed a brew upgrade/update and post that I have been seeing the following error while starting my django server

    OSError: dlopen(/usr/local/opt/gdal/lib/libgdal.dylib, 0x0006): Library not loaded: /usr/local/homebrew/opt/libtiff/lib/libtiff.5.dylib
  Referenced from: <33E7E7D2-EDA5-33CC-AFB4-2F35C8A1E369> /usr/local/opt/gdal/lib/libgdal.32.3.6.4.dylib
  Reason: tried: '/usr/local/homebrew/opt/libtiff/lib/libtiff.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/homebrew/opt/libtiff/lib/libtiff.5.dylib' (no such file), '/usr/local/homebrew/opt/libtiff/lib/libtiff.5.dylib' (no such file), '/usr/local/lib/libtiff.5.dylib' (no such file), '/usr/lib/libtiff.5.dylib' (no such file, not in dyld cache), '/usr/local/homebrew/Cellar/libtiff/4.5.1/lib/libtiff.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/homebrew/Cellar/libtiff/4.5.1/lib/libtiff.5.dylib' (no such file), '/usr/local/homebrew/Cellar/libtiff/4.5.1/lib/libtiff.5.dylib' (no such file), '/usr/local/lib/libtiff.5.dylib' (no such file), '/usr/lib/libtiff.5.dylib' (no such file, not in dyld cache)

When checking in the respective location, I'm seeing that the libtiff file that my system has is

$ pwd
/usr/local/homebrew/opt/libtiff/lib
$ ls
libtiff.6.dylib     libtiffxx.6.dylib   pkgconfig
libtiff.a       libtiffxx.a
libtiff.dylib       libtiffxx.dylib


$ pwd
/usr/local/opt/gdal/lib
$ ls
cmake           libgdal.32.dylib    python3.11
gdalplugins     libgdal.dylib
libgdal.32.3.6.4.dylib  pkgconfig

So it seems as if my system is looking for libtiff.5.dylib but my current version installed is libtiff.6.dylib.

How do i resolve this?

2

There are 2 best solutions below

0
samuel agyekum-hene On

The problem started when i installed the new mac os 17, sanoma and non of my libraries was working.

This fixed it for me.

  1. uninstall homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
  2. install Homebrew again /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  3. Reinstall the commands to run your django server (php in my case)
0
Raydot On

Just because of how much time I spent today trying to solve the issue of getting Python to run libtiff.5.dylib and not libtiff.6.dylib today, I'm posting this answer. It's not specific to Django Server, but it is specific to libtiff. I'm running Mac OS Sonoma 14.1.

I think the problem is that Homebrew just doesn't play nice with some versions of Python libraries. After repeatedly getting the dreaded cannot create wheel error trying to install libtiff again and again what I finally did is install and upgrade Conda and restart my terminal. Worked like a charm.

My guess is that worked because Conda is more Python-specific than Homebrew, so it properly installed and linked all of the relevant libraries that Homebrew could not. But that's just a guess.