# Bug in LinearAlgebra + Plots-PyPlot combo on intel i9-9900?

**URL:** <https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097>\
**Category:** General Usage\
**Created:** [August 1, 2020, 6:52pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097 "2020-08-01T18:52:28Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [August 1, 2020, 6:52pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/1 "2020-08-01T18:52:29Z")

</div>

I have two computers with intel i9-9900 (new HP dekstop at work + Lenovo home computer), giving the same error on a simple problem – while my laptop (i7) and old work desktop (Dell, Xeon processor?) works fine. Here is the essence of the weird problem:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/a/7aba577001707c70bd125c1d24dded1884a94fc9.png)

As you see, the rank is computed incorrectly after a plot, while if I repeat the computation, the answer is correct.

Now, consider the case of using the GR backend:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/b/fb86e0f83d6e353c94dedbe489692965517d8ef6.png)

Some more info:

1. I use OpenBLAS
2. The incorrect computation of the rank (and SVD…) doesn’t show up for all matrix sizes – for smaller values of `m`, the problem may disappear.
3. On my old (Dell, Xeon?) and new (HP, i9-9900 high power) work desktops, I have installed exactly the same Julia packages and package versions with Julia v 1.4.2. The installation of other software may vary, though. The above code works with `PyPlot` on my old desktop but not on my new desktop.
4. The Julia packages on my home computer (Lenovo, i9-9900 low power) and my laptop (Microsoft, i7) are probably different, and I think I use Julia v. 1.4.0 on my laptop + Julia v. 1.4.2 on my (new) home computer. The above code works with `PyPlot` on my laptop (i7), but not with my new (i9) home computer.
5. The same error shows up if I run the code in VScode.

I understand that some other Julia user had a similar problem on an i9-9900 gaming computer running model `fit` in the `Polynomials` package (which is where I, too, came across the problem). To me, it seems like the problem relates to some interaction between `LinearAlgebra` and `PyPlot` on some processors…??

Is anyone with an `i9-9900` (or other `i9` processors) able to recreate this bug?

---

<div class="post-metadata">

**Author:** ![purplishrock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/purplishrock/32/13451_2.png) [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Post date:** [August 1, 2020, 7:38pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/2 "2020-08-01T19:38:02Z")

</div>

do you get the same problem if you use PyPlots directly instead of using it as a back-end for Plots ?

what happens if you take your example and put it in a function ?

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [August 1, 2020, 8:07pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/3 "2020-08-01T20:07:36Z")

</div>

Like this?

 ![image](https://global.discourse-cdn.com/julialang/original/3X/d/c/dce16b27548e9d13742b19ec6e9b67da9f11e361.png)

Seems like this resolves the problem?? (I haven’t used PyPlot directly before).

Does this indicate that the problem is in the Plots ↔ pyplot backend interface?

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [August 1, 2020, 8:10pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/4 "2020-08-01T20:10:45Z")

</div>

> [@purplishrock](#):
>
> what happens if you take your example and put it in a function ?

It is not 100% clear to me what I should put in a function. You mean to put `rang` in a function, or both `plot` and `rang`?

It sure won’t help to just put `rand` in a function – the whole problem showed up because of an error message in the `fit` function of `Polynomials.jl` (`fit` uses `pinv`, and hence crashes because of a problem with `svd`).

---

<div class="post-metadata">

**Author:** ![purplishrock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/purplishrock/32/13451_2.png) [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Post date:** [August 1, 2020, 8:43pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/5 "2020-08-01T20:43:46Z")

</div>

> [@BLI](#):
>
> It is not 100% clear to me what I should put in a function. You mean to put `rang` in a function, or both `plot` and `rang` ?

I mean put the entirety of your example in a function. Your screen shot makes it looks like your are doing this from the REPL.

> [@BLI](#):
>
> Seems like this resolves the problem?? (I haven’t used PyPlot directly before).

I always use PyPlot directly. Since the Plots package is doing intermediate processing and is macro-heavy (I think) and then hands it off to the backend, i was wondering if the plots processing was having a side-effect.

That was the reason for also suggesting to put the whole example in a single function, since that will force all the variables to be local in scope and get everything out of the global environment.

also, it’s usually best to create a self-contained function and then insert it into the discussion in text as a code block using ``` so people can try it out easily instead of having to type it in from a screen shot, e.g.

```julia
using PyPlot
using LinearAlgebra

function test1()
  m = 15
  ...
end

etc...

```

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [August 1, 2020, 10:18pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/6 "2020-08-01T22:18:32Z")

</div>

Something like this (run on my Lenovo i9 machine)?

 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/5/7504c97fb5d4ff9490e9bd86745d3608c9cbdc7e.png)

I’m not sure why 2 figures are plotted, or more precisely: I’m not sure why the _first_ figure is plotted. If I skip the `display(fig)` statement, I get the following:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/a/aaa80a7213243ad663a429b6b06c4a7362d42365.png)  
So – it seems like it is the _rendering_ of the plot that causes the problem.

---

<div class="post-metadata">

**Author:** ![purplishrock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/purplishrock/32/13451_2.png) [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Post date:** [August 2, 2020, 5:18am UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/7 "2020-08-02T05:18:33Z")

</div>

yes. that’s the idea.

as i said i don’t know plots at all, so i’m not sure why you are seeing 2 plots.

this is a very odd problem, and if it’s reproducible, which it appears to be, it seems like a serious bug of some sort, and probably not a CPU related problem.

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [August 2, 2020, 11:02am UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/8 "2020-08-02T11:02:45Z")

</div>

OK – function test on my laptop (Surface Book 2, with i7 processor) – with `pyplot()`:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/5/85a3d38d6f874e819b55f7bec7211ce535bbd535.png)

Three observations:

1. The `rank` function _works_ on the i7 processor.
2. Why two plots??
3. Why does the first plot appear in the middle of the first `println()` command?

Using the `gr()` gives the following result on the i7:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/6/a6384296833cc8b2356e27e031e9ddb0f277261f.png)

OK – here, there is only one plot. And the `rank` command works. But why does the plot appear _before_ the `rank(A):5` printout?

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [August 2, 2020, 11:18am UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/9 "2020-08-02T11:18:16Z")

</div>

I know it is dangerous to generalize based on testing on 4 computers. But it appears like:

1. On all machines (? – have only tested on private i7 laptop + private i9 PC), it looks like the `pyplot` backend prints _two_ plots, while only one is expected.
2. On both i9 processor machines I have tested, the `rank()` function computes the wrong result _for certain matrices_ when I use the `pyplot()` backend prior to the `rank()` command. Non-i9 machines compute the correct value with the `rank()` function.
3. Using the `gr()` backend for `Plots`, only _one_ plot is printed (as expected, but perhaps in an unexpected sequence). _AND_, issuing the `plot` command prior to calling the `rank()` function does not mess up the `rank` result.

OK – why don’t I switch to the `gr()` backend? After all, the `gr()` backend tends to give somewhat crisper plots, which is _good_. I’m still holding back to switch to `gr()` because:

- The `gr()` backend has poorer support for `LaTeX` commands than `pyplot()`. I _really_ look forward to when the JuliaCon 2020 announced extended support for LaTeX in `GR` is implemented in the backend.
- The `gr()` backend supports fewer plot keywords. Hopefully this will also improve.

In any way, I hope someone can do a more thorough check on the problems with the `pyplot()` backend in relation to the `LinearAlgebra` package.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [August 2, 2020, 12:23pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/10 "2020-08-02T12:23:22Z")

</div>

> [@BLI](#):
>
> As you see, the rank is computed incorrectly after a plot, while if I repeat the computation, the answer is correct.

Are you using an MKL-based build for linear algebra? There seems to be a conflict with a linear-algebra library loaded by NumPy:

> <https://github.com/JuliaPy/PyPlot.jl/issues/477>
>
> Let me start with how to reproduce: 
> \`\`\`julia
> julia\> using LinearAlgebra, PyPl…ot
> 
> julia\> xlim(\[-1, 1\]) # a window will pop up, leave the window open.
> (-1, 1)
> 
> julia\> H = rand(46, 46)+im\*rand(46, 46);
> 
> julia\> values, vectors = eigen(Hermitian(H))
> Eigen{Complex{Float64},Float64,Array{Complex{Float64},2},Array{Float64,1}}
> values:
> 0-element Array{Float64,1} # should have been a 46 element array
> vectors:
> 46×0 Array{Complex{Float64},2}
> 
> julia\> versioninfo() # official binary
> Julia Version 1.4.0
> Commit b8e9a9ecc6 (2020-03-21 16:36 UTC)
> Platform Info:
> OS: Windows (x86\_64-w64-mingw32)
> CPU: Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
> WORD\_SIZE: 64
> LIBM: libopenlibm
> LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
> 
> (@v1.4) pkg\> st
> Status \`C:\\Users\\wangc\\.julia\\environments\\v1.4\\Project.toml\`
> \[c52e3926\] Atom v0.12.10
> \[6e4b80f9\] BenchmarkTools v0.5.0
> \[861a8166\] Combinatorics v1.0.0
> \[27194a60\] Hop v0.1.0 \[\`D:/Workspace/Hop.jl\`\]
> \[7073ff75\] IJulia v1.21.1
> \[6a3955dd\] ImageFiltering v0.6.11
> \[e5e0dc1b\] Juno v0.8.1
> \[5b5b96b6\] MoireRelaxation v0.1.0 \[\`D:/Workspace/MoireRelaxation.jl\`\]
> \[429524aa\] Optim v0.20.6
> \[438e738f\] PyCall v1.91.4
> \[d330b81b\] PyPlot v2.9.0
> \`\`\`
> 
> Several observations:
> - Only the first run of \`values, vectors = eigen(Hermitian(H))\` will give the wrong result. If the statement is run a second time, the eigenvalues and eigenvectors are correct.
> - I am not sure this is a Windows issue since I don't have linux machines with gui. To reproduce, the gui is essential: if \`PyPlot\` is started with \`Agg\` backend, the eigenvalues are correct.
> - The number \`46\` is not very special and \`24\`, \`12\` would also reproduce this. However, if the number is \`4\`. I cannot reproduce this on my machine.
> - If I collect all the statements in a file \`run.jl\` and do \`include(run.jl)\` in the REPL, I cannot reproduce this.
> 
> 
> \<details\>
> \<summary\>Python package list:\</summary\>
> 
> \`\`\`
> (base) C:\\Users\\wangc\>conda list
> \# packages in environment at C:\\Users\\wangc\\.julia\\conda\\3:
> \#
> \# Name Version Build Channel
> anaconda-client 1.7.2 py37\_0
> anaconda-navigator 1.9.12 py37\_0
> apscheduler 3.6.3 py37\_0
> ase 3.19.1 py\_0 conda-forge
> asn1crypto 1.3.0 py37\_0
> attrs 19.3.0 py\_0
> backcall 0.1.0 py37\_0
> blas 1.0 mkl
> bleach 3.1.0 py37\_0
> bzip2 1.0.8 he774522\_0
> ca-certificates 2020.1.1 0
> certifi 2020.4.5.1 py37\_0
> cffi 1.14.0 py37h7a1dbc1\_0
> cftime 1.1.1.1 py37h2a96729\_0
> chardet 3.0.4 py37\_1003
> click 7.1.1 py\_0
> cloudpickle 1.3.0 py\_0
> clyent 1.2.2 py37\_1
> colorama 0.4.3 py\_0
> conda 4.8.3 py37\_0
> conda-package-handling 1.6.0 py37h62dcd97\_0
> console\_shortcut 0.1.1 4
> cryptography 2.8 py37h7a1dbc1\_0
> curl 7.69.1 h2a8f88b\_0
> cycler 0.10.0 py37\_0
> cytoolz 0.10.1 py37he774522\_0
> dask-core 2.14.0 py\_0
> decorator 4.4.2 py\_0
> defusedxml 0.6.0 py\_0
> entrypoints 0.3 py37\_0
> expat 2.2.5 he025d50\_0
> fastcache 1.1.0 py37he774522\_0
> flask 1.1.1 py\_1
> freetype 2.9.1 ha9979f8\_1
> future 0.18.2 py37\_0
> geos 3.8.0 h33f27b4\_0
> hdf4 4.2.13 h712560f\_2
> hdf5 1.10.4 h7ebc959\_0
> icc\_rt 2019.0.0 h0cc432a\_1
> icu 58.2 ha66f8fd\_1
> idna 2.9 py\_1
> imageio 2.8.0 py\_0
> importlib\_metadata 1.5.0 py37\_0
> intel-openmp 2020.0 166
> ipykernel 5.1.4 py37h39e3cac\_0
> ipython 7.13.0 py37h5ca1d4c\_0
> ipython\_genutils 0.2.0 py37\_0
> itsdangerous 1.1.0 py37\_0
> jedi 0.16.0 py37\_1
> jinja2 2.11.1 py\_0
> jpeg 9b hb83a4c4\_2
> json5 0.9.4 py\_0
> jsoncpp 1.8.4 h74a9793\_0
> jsonschema 3.2.0 py37\_0
> jupyter\_client 6.1.2 py\_0
> jupyter\_core 4.6.3 py37\_0
> jupyterlab 1.2.6 pyhf63ae98\_0
> jupyterlab\_server 1.1.0 py\_0
> kiwisolver 1.1.0 py37ha925a31\_0
> krb5 1.17.1 hc04afaa\_0
> latexcodec 2.0.0 py\_0 conda-forge
> libcurl 7.69.1 h2a8f88b\_0
> libiconv 1.15 h1df5818\_7
> libnetcdf 4.6.1 h411e497\_2
> libpng 1.6.37 h2a8f88b\_0
> libsodium 1.0.16 h9d3ae62\_0
> libssh2 1.9.0 h7a1dbc1\_1
> libtiff 4.1.0 h56a325e\_0
> libxml2 2.9.9 h464c3ec\_0
> lz4-c 1.8.1.2 h2fa13f4\_0
> m2w64-gcc-libgfortran 5.3.0 6
> m2w64-gcc-libs 5.3.0 7
> m2w64-gcc-libs-core 5.3.0 7
> m2w64-gmp 6.1.0 2
> m2w64-libwinpthread-git 5.0.0.4634.697f757 2
> markupsafe 1.1.1 py37he774522\_0
> matplotlib 3.1.3 py37\_0
> matplotlib-base 3.1.3 py37h64f37c6\_0
> menuinst 1.4.16 py37he774522\_0
> mistune 0.8.4 py37he774522\_0
> mkl 2020.0 166
> mkl-service 2.3.0 py37hb782905\_0
> mkl\_fft 1.0.15 py37h14836fe\_0
> mkl\_random 1.1.0 py37h675688f\_0
> monty 3.0.2 py\_0 conda-forge
> mpmath 1.1.0 py37\_0
> msys2-conda-epoch 20160418 1
> nbconvert 5.6.1 py37\_0
> nbformat 5.0.4 py\_0
> netcdf4 1.4.2 py37h812ae01\_0
> networkx 2.4 py\_0
> nodejs 10.13.0 0
> notebook 6.0.3 py37\_0
> numpy 1.18.1 py37h93ca92e\_0
> numpy-base 1.18.1 py37hc3f5095\_1
> olefile 0.46 py37\_0
> openssl 1.1.1f he774522\_0
> palettable 3.3.0 py\_0
> pandas 0.25.1 py37ha925a31\_0
> pandoc 2.2.3.2 0
> pandocfilters 1.4.2 py37\_1
> parso 0.6.2 py\_0
> pickleshare 0.7.5 py37\_0
> pillow 7.0.0 py37hcc1f983\_0
> pip 20.0.2 py37\_1
> plotly 4.6.0 py\_0
> powershell\_shortcut 0.0.1 3
> prometheus\_client 0.7.1 py\_0
> prompt-toolkit 3.0.4 py\_0
> prompt\_toolkit 3.0.4 0
> psutil 5.7.0 py37he774522\_0
> pybtex 0.22.2 py37hc8dfbb8\_1 conda-forge
> pycosat 0.6.3 py37he774522\_0
> pycparser 2.20 py\_0
> pydispatcher 2.0.5 py37\_1
> pygments 2.6.1 py\_0
> pymatgen 2020.4.2 py37heaa310e\_0 conda-forge
> pyopenssl 19.1.0 py37\_0
> pyparsing 2.4.6 py\_0
> pyqt 5.9.2 py37h6538335\_2
> pyrsistent 0.16.0 py37he774522\_0
> pysocks 1.7.1 py37\_0
> python 3.7.7 h60c2a47\_0\_cpython
> python-dateutil 2.8.1 py\_0
> python\_abi 3.7 1\_cp37m conda-forge
> pytz 2019.3 py\_0
> pywavelets 1.1.1 py37he774522\_0
> pywin32 227 py37he774522\_1
> pywinpty 0.5.7 py37\_0
> pyyaml 5.3.1 py37he774522\_0
> pyzmq 18.1.1 py37ha925a31\_0
> qt 5.9.7 vc14h73c81de\_0
> qtpy 1.9.0 py\_0
> requests 2.23.0 py37\_0
> retrying 1.3.3 py37\_2
> ruamel.yaml 0.16.5 py37he774522\_1
> ruamel.yaml.clib 0.2.0 py37he774522\_0
> ruamel\_yaml 0.15.87 py37he774522\_0
> scikit-image 0.16.2 py37h47e9c7a\_0
> scipy 1.4.1 py37h9439919\_0
> send2trash 1.5.0 py37\_0
> setuptools 46.1.3 py37\_0
> shapely 1.6.4 py37hd830579\_0
> sip 4.19.8 py37h6538335\_0
> six 1.14.0 py37\_0
> spglib 1.14.1 py37hbc2f12b\_1 conda-forge
> sqlite 3.31.1 he774522\_0
> sympy 1.5.1 py37\_0
> tabulate 0.8.3 py37\_0
> tbb 2020.0 h74a9793\_0
> terminado 0.8.3 py37\_0
> testpath 0.4.4 py\_0
> tk 8.6.8 hfa6e2cd\_0
> toolz 0.10.0 py\_0
> tornado 6.0.4 py37he774522\_1
> tqdm 4.44.1 py\_0
> traitlets 4.3.3 py37\_0
> tzlocal 2.0.0 py37\_0
> urllib3 1.25.8 py37\_0
> vc 14.1 h0510ff6\_4
> vs2015\_runtime 14.16.27012 hf0eaf9b\_1
> vtk 8.2.0 py37h1e53df8\_200
> wcwidth 0.1.9 py\_0
> webencodings 0.5.1 py37\_1
> werkzeug 1.0.0 py\_0
> wheel 0.34.2 py37\_0
> win\_inet\_pton 1.1.0 py37\_0
> wincertstore 0.2 py37\_0
> winpty 0.4.3 4
> xmltodict 0.12.0 py\_0
> xz 5.2.4 h2fa13f4\_4
> yaml 0.1.7 hc54c509\_2
> zeromq 4.3.1 h33f27b4\_3
> zipp 2.2.0 py\_0
> zlib 1.2.11 h62dcd97\_3
> zstd 1.3.7 h508b16e\_0
> \`\`\`
> \</details\>

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [August 2, 2020, 12:45pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/11 "2020-08-02T12:45:00Z")

</div>

> [@stevengj](#):
>
> Are you using an MKL-based build for linear algebra?

I’m using OpenBLAS. I have not installed MKL.jl; just using the standard installation of Julia.

I tried to install MKL.jl on my work desktop a couple of days ago in the hope that this might solve the problem. That lead to some “Terminal error” or something, and just stopped the Julia session, so I removed Julia completely with all packages, and reinstalled it.

---

<div class="post-metadata">

**Author:** ![Alec\_Loudenback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alec_loudenback/32/278_2.png) [@Alec\_Loudenback](https://discourse.julialang.org/u/Alec_Loudenback)\
**Post date:** [August 2, 2020, 2:30pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/12 "2020-08-02T14:30:11Z")

</div>

FWIW I do not reproduce this with a 9900k (OpenBLAS) and Julia 1.5.0:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/b/6/b68e3341b5121aaab30a1bf20b5175faefba95f2.png)

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [August 2, 2020, 3:10pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/13 "2020-08-02T15:10:01Z")

</div>

Hm… Thanks for reporting. I’ll check v. 1.5.0 when it is released, and follow up.

---

<div class="post-metadata">

**Author:** ![xixit](https://avatars.discourse-cdn.com/v4/letter/x/b9bd4f/32.png) [@xixit](https://discourse.julialang.org/u/xixit)\
**Post date:** [August 2, 2020, 4:35pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/14 "2020-08-02T16:35:10Z")

</div>

Have you tried to set the threads number according to your actual cpu cores?  
core i9-9900 has 8 physical cores. So, please check the following command:

LinearAlgebra.BLAS.set\_num\_threads(8)

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [August 2, 2020, 4:58pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/15 "2020-08-02T16:58:06Z")

</div>

Setting the number of threads doesn’t change the result. On my i9-9900 home PC:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/6/6/66e20f77e11a033cc45cf7725cbd89f49ffebd43.png)

---

<div class="post-metadata">

**Author:** ![Chong\_Wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chong_wang/32/20307_2.png) [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Post date:** [August 2, 2020, 7:18pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/16 "2020-08-02T19:18:13Z")

</div>

I reported the issue in [https://github.com/JuliaPy/PyPlot.jl/issues/477](https://github.com/JuliaPy/PyPlot.jl/issues/477), and I can reproduce the issue that @BLI reports here.

I am not using MKL.jl so I don’t think library conflict is the cause. I am on a laptop with i5-8265U.

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [August 2, 2020, 7:30pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/17 "2020-08-02T19:30:48Z")

</div>

Hm. I use OpenBLAS on all computers. OK – it also happens on non-i9 processors.

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [August 2, 2020, 8:00pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/18 "2020-08-02T20:00:53Z")

</div>

Looks like you’re running in a Jupyter notebook - does the issue also occur in the REPL? If not, might be a problem with jupyter and not plots/pyplot.

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [August 2, 2020, 8:31pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/19 "2020-08-02T20:31:23Z")

</div>

I get exactly the same behavior when I run the code in VScode. (See point 5 in my list of “some more info” in my first entry.)

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [August 3, 2020, 8:14am UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097/20 "2020-08-03T08:14:48Z")

</div>

I have now removed every trace of Julia 1.4.2 + Jupyter + conda/Python from my i9-9900 work desktop computer, downloaded and installed Julia 1.5.0 + added packages Plots and PyPlot. No other packages. Still does not work. In Jupyterlab:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/d/9/d98610fe43022221c5fedce6c317e0b5ff4a76ef.png)

In VScode:

```julia
using Plots; pyplot()
using LinearAlgebra
#
function test1()
    m = 15
    A = rand(m,5)
    B = rand(m,5)
    println("rank(A):", rank(A))
    plot(sin,size=(100,100)) |> display
    println("rank(B):", rank(B))
    println("rank(B):",rank(B))
end
#
test1()

```

with REPL response:

```julia
julia> using Plots; pyplot()
Plots.PyPlotBackend()

julia> using LinearAlgebra

rank(A):5
rank(B):0
rank(B):5

```

[Next page](https://discourse.julialang.org/t/bug-in-linearalgebra-plots-pyplot-combo-on-intel-i9-9900/44097.md?page=2)
