# Intel MKL FATAL ERROR with PyPlot

**URL:** <https://discourse.julialang.org/t/intel-mkl-fatal-error-with-pyplot/36737>\
**Category:** New to Julia\
**Created:** [March 30, 2020, 1:17pm UTC](https://discourse.julialang.org/t/intel-mkl-fatal-error-with-pyplot/36737 "2020-03-30T13:17:28Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![gideonsimpson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gideonsimpson/32/1928_2.png) [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Post date:** [March 30, 2020, 1:17pm UTC](https://discourse.julialang.org/t/intel-mkl-fatal-error-with-pyplot/36737/1 "2020-03-30T13:17:28Z")

</div>

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
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.

---

<div class="post-metadata">

**Author:** ![fgerick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fgerick/32/13228_2.png) [@fgerick](https://discourse.julialang.org/u/fgerick)\
**Post date:** [March 30, 2020, 2:51pm UTC](https://discourse.julialang.org/t/intel-mkl-fatal-error-with-pyplot/36737/2 "2020-03-30T14:51:20Z")

</div>

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](https://github.com/JuliaComputing/MKL.jl/pull/35) to MKL.jl to fix that issue. You can use [my fork](https://github.com/fgerick/MKL.jl) of MKL.jl in the meantime to make it work.

---

<div class="post-metadata">

**Author:** ![gideonsimpson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gideonsimpson/32/1928_2.png) [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Post date:** [March 30, 2020, 8:55pm UTC](https://discourse.julialang.org/t/intel-mkl-fatal-error-with-pyplot/36737/3 "2020-03-30T20:55:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![amrods](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amrods/32/2543_2.png) [@amrods](https://discourse.julialang.org/u/amrods)\
**Post date:** [August 7, 2020, 3:53pm UTC](https://discourse.julialang.org/t/intel-mkl-fatal-error-with-pyplot/36737/4 "2020-08-07T15:53:25Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![onButtonUp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/onbuttonup/32/3098_2.png) [@onButtonUp](https://discourse.julialang.org/u/onButtonUp)\
**Post date:** [August 7, 2020, 6:23pm UTC](https://discourse.julialang.org/t/intel-mkl-fatal-error-with-pyplot/36737/5 "2020-08-07T18:23:34Z")

</div>

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 . . . )

---

<div class="post-metadata">

**Author:** ![onButtonUp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/onbuttonup/32/3098_2.png) [@onButtonUp](https://discourse.julialang.org/u/onButtonUp)\
**Post date:** [August 8, 2020, 12:39am UTC](https://discourse.julialang.org/t/intel-mkl-fatal-error-with-pyplot/36737/6 "2020-08-08T00:39:47Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![onButtonUp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/onbuttonup/32/3098_2.png) [@onButtonUp](https://discourse.julialang.org/u/onButtonUp)\
**Post date:** [August 8, 2020, 2:59am UTC](https://discourse.julialang.org/t/intel-mkl-fatal-error-with-pyplot/36737/7 "2020-08-08T02:59:07Z")

</div>

The following seems to work . . .

export LD\_LIBRARY\_PATH=~/.julia/conda/3/lib

More information at the bottom [here](https://github.com/JuliaPy/PyPlot.jl/issues/315).

(phew . . .)

---

<div class="post-metadata">

**Author:** ![amrods](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amrods/32/2543_2.png) [@amrods](https://discourse.julialang.org/u/amrods)\
**Post date:** [August 8, 2020, 3:44am UTC](https://discourse.julialang.org/t/intel-mkl-fatal-error-with-pyplot/36737/8 "2020-08-08T03:44:44Z")

</div>

any idea how to solve it for VS Code?

---

<div class="post-metadata">

**Author:** ![onButtonUp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/onbuttonup/32/3098_2.png) [@onButtonUp](https://discourse.julialang.org/u/onButtonUp)\
**Post date:** [August 8, 2020, 5:23am UTC](https://discourse.julialang.org/t/intel-mkl-fatal-error-with-pyplot/36737/9 "2020-08-08T05:23:22Z")

</div>

Modifying `.zshrc` with the following works :

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

```

---

<div class="post-metadata">

**Author:** ![amrods](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amrods/32/2543_2.png) [@amrods](https://discourse.julialang.org/u/amrods)\
**Post date:** [August 8, 2020, 9:35am UTC](https://discourse.julialang.org/t/intel-mkl-fatal-error-with-pyplot/36737/10 "2020-08-08T09:35:52Z")

</div>

Fantastic, thanks!

---

<div class="post-metadata">

**Author:** ![fratrik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fratrik/32/678_2.png) [@fratrik](https://discourse.julialang.org/u/fratrik)\
**Post date:** [April 3, 2021, 6:06pm UTC](https://discourse.julialang.org/t/intel-mkl-fatal-error-with-pyplot/36737/11 "2021-04-03T18:06:22Z")

</div>

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 -

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

```

from [pyimport got stuck with deadlock · Issue #801 · JuliaPy/PyCall.jl · GitHub](https://github.com/JuliaPy/PyCall.jl/issues/801#issuecomment-676500884)

```julia

```
