PyCall.jl icon indicating copy to clipboard operation
PyCall.jl copied to clipboard

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

Open truedichotomy opened this issue 4 years ago • 7 comments

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 avatar Apr 19 '21 16:04 truedichotomy

This may be related to issue #891.

truedichotomy avatar Apr 22 '21 17:04 truedichotomy

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.

truedichotomy avatar Apr 22 '21 18:04 truedichotomy

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?

tk3369 avatar May 09 '21 17:05 tk3369

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!

m-elder avatar May 11 '21 16:05 m-elder

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.

gideonsimpson avatar Jun 06 '21 14:06 gideonsimpson

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.

mjohnson541 avatar Aug 06 '21 16:08 mjohnson541

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

terasakisatoshi avatar Nov 08 '22 13:11 terasakisatoshi