llvmlite: Library not loaded: @rpath/libz.1.dylib

I am getting this error


OSError: dlopen(/Library/Python/2.7/site-packages/llvmlite/binding/libllvmlite.dylib, 6): Library not loaded: @rpath/libz.1.dylib
  Referenced from: /Library/Python/2.7/site-packages/llvmlite/binding/libllvmlite.dylib
  Reason: image not found

python path /usr/bin/python

pip path /usr/local/bin/pip

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 26 (12 by maintainers)

Most upvoted comments

Hi,

the 2 commands helped, however I had to do two more (maybe my specific usecase, not sure since I’m new into this):

sudo install_name_tool -change "@rpath/libc++.1.dylib" "/usr/lib/libc++.1.dylib" /Library/Python/2.7/site-packages/numba/typeconv/_typeconv.so
sudo install_name_tool -change "@rpath/libc++.1.dylib" "/usr/lib/libc++.1.dylib" /Library/Python/2.7/site-packages/numba/_dispatcher.so

Thanks a lot for all your help!

OK, after trying a bunch of things and being shot down by System Integrity Protection, this is the best workaround we can come up with.

Assuming you are seeing the library open error for the exact path /Library/Python/2.7/site-packages/llvmlite/binding/libllvmlite.dylib, you should do the following:

sudo install_name_tool -change "@rpath/libz.1.dylib" "/usr/lib/libz.1.dylib" /Library/Python/2.7/site-packages/llvmlite/binding/libllvmlite.dylib
sudo install_name_tool -change "@rpath/libc++.1.dylib" "/usr/lib/libc++.1.dylib" /Library/Python/2.7/site-packages/llvmlite/binding/libllvmlite.dylib

Note that this fix will need to be repeated if you reinstall llvmlite, and this should not be needed for any Python other than the Python shipped by macOS.

Moving forward, we’re going to see if we can get this fix applied automatically when we build the wheel.

We are puzzled that we have not been able to reproduce this (including a fresh install of macOS) on any system we have access to so far.

As a very unlikely fix, can you try running this in your terminal before running your program?

export DYLD_LIBRARY_PATH=/usr/lib:$DYLD_LIBRARY_PATH

(The effect of this command will be temporary, just close and reopen your terminal window to get back to normal.)

I have traced the issue described in https://github.com/rstudio/rstudio/issues/13967 to import llvmlite.binding. I won’t rehash much – there is no issue using Python shell or the older version of RStudio + Reticulate but there is an issue using R on Terminal + Reticulate or the newer version of RStudio + Reticulate.