# Jupyter lab StackOverflowError when computing inverse matrix

**URL:** <https://discourse.julialang.org/t/jupyter-lab-stackoverflowerror-when-computing-inverse-matrix/72691>\
**Category:** Jupyter-Notebook\
**Tags:** stackoverflow\
**Created:** [December 7, 2021, 3:16am UTC](https://discourse.julialang.org/t/jupyter-lab-stackoverflowerror-when-computing-inverse-matrix/72691 "2021-12-07T03:16:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrazomej](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrazomej/32/31141_2.png) [@mrazomej](https://discourse.julialang.org/u/mrazomej)\
**Post date:** [December 7, 2021, 3:16am UTC](https://discourse.julialang.org/t/jupyter-lab-stackoverflowerror-when-computing-inverse-matrix/72691/1 "2021-12-07T03:16:30Z")

</div>

I recently updated Julia to version 1.7. When trying to do a straightforward computation in the Jupyterlab environment such as:

```julia
using Random

Random.seed!(42)

A = rand(1000, 1000)

inv(A)

```

I get the following error (literally just one word and nothing else):

```julia
StackOverflowError:

```

The same commands ran on the REPL do not give this error. I tried with my Anaconda-installed Jupyter lab and the installation using the `IJulia` package, but it made no difference. Only the VSCode implementation of the Jupyter notebook works. The issue in VSCode is that I cannot instantiate a multi-threaded kernel.

Any idea what could be going on and how can I fix it?

Thanks!

---

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [December 7, 2021, 3:33am UTC](https://discourse.julialang.org/t/jupyter-lab-stackoverflowerror-when-computing-inverse-matrix/72691/2 "2021-12-07T03:33:11Z")

</div>

Hey @mrazomej, welcome to the forum!

If you are on macOS, it may be this bug:

> [@'inv' Causes Stack Overflow on Julia 1.7.0 and Mac OS](https://discourse.julialang.org/t/inv-causes-stack-overflow-on-julia-1-7-0-and-mac-os/72411/15):
>
> TLDR: it’s [this Julia issue](https://github.com/JuliaLang/julia/issues/43008) (also reported [here](https://github.com/JuliaLang/julia/issues/43301)), caused by a [problem with the OpenBLAS package](https://github.com/JuliaPackaging/Yggdrasil/issues/3996) where an experimental feature threading feature was accidentally enabled in the package used for the Julia release. Seems like it will require a rapid Julia 1.7.1 bugfix release. Workaround is to call BLAS.set\_num\_threads(1) for now frowning, or downgrade to Julia 1.6.3 until a fix is released.

Unfortunately it was overlooked before launch. We need to wait until a new version comes to have it fixed. Another option is using MKL instead of openblas as the linear algebra library.

---

<div class="post-metadata">

**Author:** ![mrazomej](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrazomej/32/31141_2.png) [@mrazomej](https://discourse.julialang.org/u/mrazomej)\
**Post date:** [December 7, 2021, 4:47am UTC](https://discourse.julialang.org/t/jupyter-lab-stackoverflowerror-when-computing-inverse-matrix/72691/3 "2021-12-07T04:47:49Z")

</div>

Thank you so much! I’ll downgrade to 1.6 in the meantime then.

---

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [December 7, 2021, 5:00am UTC](https://discourse.julialang.org/t/jupyter-lab-stackoverflowerror-when-computing-inverse-matrix/72691/4 "2021-12-07T05:00:02Z")

</div>

Yes, I think it has to be 1.6.3 because 1.6.4 has the same issue.
