JuliaPy / PyCall.jl

Package to call Python functions from the Julia language
MIT License
1.47k stars 187 forks source link

INTEL MKL ERROR: dlopen(/Users/user/opt/anaconda3/lib/libmkl_intel_thread.dylib, 9): Library not loaded: @rpath/libiomp5.dylib #895

Open truedichotomy opened 3 years ago

truedichotomy commented 3 years ago

I'm encountering a crash of julia when trying to use PyCall.jl.

I installed anaconda then set ENV["PYTHON"] to the anaconda python, rebuild PyCall then when I try to do a simple plt = pyimport("matplotlib.pyplot"), Julia crashes. Here is the full error message:

INTEL MKL ERROR: dlopen(/Users/user/opt/anaconda3/lib/libmkl_intel_thread.dylib, 9): Library not loaded: @rpath/libiomp5.dylib
  Referenced from: /Users/user/opt/anaconda3/lib/libmkl_intel_thread.dylib
  Reason: image not found.
Intel MKL FATAL ERROR: Cannot load libmkl_intel_thread.dylib.

I checked the anaconda directories and libmkl_intel_thread.dylib and libiomp5.dylib are both present.

I'm running Julia 1.6.0 on macOS 10.15.7.

truedichotomy commented 3 years ago

This may be related to issue #891.

truedichotomy commented 3 years ago

If I use Conda.jl inside Julia. I still encounter the same issue eventhough the libraries are present in those directories:


julia> plt = pyimport("matplotlib.pyplot")
INTEL MKL ERROR: dlopen(/Users/user/.julia/conda/3/lib/libmkl_intel_thread.dylib, 9): Library not loaded: @rpath/libiomp5.dylib
  Referenced from: /Users/user/.julia/conda/3/lib/libmkl_intel_thread.dylib
  Reason: image not found.
Intel MKL FATAL ERROR: Cannot load libmkl_intel_thread.dylib.
tk3369 commented 3 years ago

I have replicated the exact same issue, as reported by someone as well on the Humans of Julia Discord server. @truedichotomy were you able to work around this issue?

m-elder commented 3 years ago

I had the exact same bug but using NEURON, and managed to resolve it just by updating anaconda, using

conda update --all

hope this helps!

gideonsimpson commented 3 years ago

I'm having this same issue too. I have a (mini)conda installation that, independently of PyCall I am happy with, as it has FEniCS working properly, but I would like to be able to use PyCall with it. After a bit of testing, I get the MKL error on numpy, matplotlib, scipy, etc; numpy seems to be the core problem.

mjohnson541 commented 3 years ago

I resolved this issue in my own installs by installing nomkl in the conda environment. I'm not very familiar with MKL, but it seemed like this was being caused by some interaction between Julia and conda's separate MKL installs.

terasakisatoshi commented 1 year ago

The following issues might be helpful for those who came here.

https://github.com/JuliaPy/PyPlot.jl/issues/315 https://github.com/JuliaPy/PyCall.jl/issues/921