Intel MKL FATAL ERROR with PyPlot

I recently tried installing FEniCS.jl. It gave some sort of error, and I didn’t think twice about it. However, now I find that if I try to use PyPlot, either directly or as a backend for Plots.jl, I get the following error:

julia> using PyPlot
INTEL MKL ERROR: dlopen(/Users/gideonsimpson/.julia/conda/3/lib/libmkl_intel_thread.dylib, 9): Library not loaded: @rpath/libiomp5.dylib
  Referenced from: /Users/gideonsimpson/.julia/conda/3/lib/libmkl_intel_thread.dylib
  Reason: image not found.
Intel MKL FATAL ERROR: Cannot load libmkl_intel_thread.dylib.

I’ve tried rebuilding PyCall and PyPlot, but that hasn’t helped.

I am working with release 1.4.

2 Likes

I assume you have installed MKL with the MKL.jl package? The interoperability with Python is a known problem and I’ve created a pull request to MKL.jl to fix that issue. You can use my fork of MKL.jl in the meantime to make it work.

1 Like

Didn’t get to try that, but I did find that if I blew away my /.julia folder and just reinstalled the packages, things worked again.

I just tried that and I still get the same error. I noticed that now anaconda is installed in ~/opt/anaconda3 instead of ~/anaconda3. Could that be the problem?

Thank for the post that removing the .julia folder fixed the problem. This seemed to fix Intel MKL FATAL ERROR: Cannot load libmkl_intel_thread.dylib problem here when trying to use PyPlot. (Although, I am not sure what this may have broke at the same time . . . )

hmmm . . . Strangely, although removing the .julia did fix the problem, the same error message is back after installing a few packages (relating to Sherlogs.jl) and getting things setup, again, for Jupyter notebooks/IJulia.
(Sorry, this is a pia.)

The following seems to work . . .

export LD_LIBRARY_PATH=~/.julia/conda/3/lib

More information at the bottom here.

(phew . . .)

3 Likes

any idea how to solve it for VS Code?

Modifying .zshrc with the following works :

addToPATH () {
    export LD_LIBRARY_PATH="$1:$LD_LIBRARY_PATH"
}
addToPATH ~/.julia/conda/3/lib
4 Likes

Fantastic, thanks!

I ran into this problem today April 3rd, 2021, although everything was working fine a few days ago on an M1 mac.

Deleting .julia did not fix the problem. I’m happy to dig deeper to find the cause if someone is interested in helping me.

This solution did work finally -

using Conda
Conda.rm("numpy")
Conda.add("numpy")

from pyimport got stuck with deadlock · Issue #801 · JuliaPy/PyCall.jl · GitHub

3 Likes