Laura
Laura

Reputation: 11

Library not loaded: @rpath/libhdf5.103.dylib when importing scanpy and tables

I've installed scanpy and all the necessary associated packages in PyCharm (tables, numpy, etc.), but when I try to import scanpy, I receive the following error:

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/tables/utilsextension.cpython-39-darwin.so, 2): Library not loaded: @rpath/libhdf5.103.dylib
  Referenced from: /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/tables/utilsextension.cpython-39-darwin.so
  Reason: image not found

The same error appears when I try importing tables, so it seems this is more fundamentally an issue with importing that package (which scanpy is dependent on). I've tried uninstalling and reinstalling scanpy and tables, as well as PyCharm itself, and I'm continuing to receive this error.

I'm new to this and honestly not even sure how to interpret the error message above or approach this issue. Should libhdf5.103.dylib be stored somewhere else? It looks like libhdf5.103.dylib currently exists under usr > opt > anaconda3 > lib on my computer. Is something else the issue?

Upvotes: 1

Views: 891

Answers (2)

Tran Minh
Tran Minh

Reputation: 171

The trick from Neuronur work. In case you want to save some of your storage, the underlying way to make it work is to create the symlink in your environment : ln -s /Users/yourLocalUserName/miniconda3/envs/your_envs_name/lib/libhdf5.dylib /Users/yourLocalUserName/miniconda3/envs/your_envs_name/lib/libhdf5.103.dylib

ln -s /Users/yourLocalUserName/miniconda3/envs/your_envs_name/lib/libhdf5_cpp.dylib /Users/yourLocalUserName/miniconda3/envs/your_envs_name/lib/libhdf5_cpp.103.dylib

Upvotes: 0

Neuronur
Neuronur

Reputation: 11

I had the same issue. Installing pytables from conda solved the issue

conda install -c anaconda pytables

I then installed scanpy using pip

Upvotes: 1

Related Questions