# Vscode-julia doesn't find intel MKL shared objects

**URL:** https://discourse.julialang.org/t/vscode-julia-doesnt-find-intel-mkl-shared-objects/52232
**Category:** VS Code
**Tags:** mkl
**Created:** [December 22, 2020, 4:58pm UTC](https://discourse.julialang.org/t/vscode-julia-doesnt-find-intel-mkl-shared-objects/52232 "2020-12-22T16:58:44Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Steven\_Varga](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steven_varga/32/3529_2.png) [@Steven\_Varga](https://discourse.julialang.org/u/Steven_Varga)
#### Post date: [December 22, 2020, 4:58pm UTC](https://discourse.julialang.org/t/vscode-julia-doesnt-find-intel-mkl-shared-objects/52232/1 "2020-12-22T16:58:44Z")

</div>

Intel MKL and compiler have provides scripts to control library path, which is/are required to be sourced before starting up the MKL linked julia; can someone point out how to work around this when using `julia` linked with `intel MKL` and `vscode-julia 1.0.10`?

```julia-auto
source /opt/intel/bin/compilervars.sh intel64
source /opt/intel/parallel_studio_xe_2020/bin/psxevars.sh &> /dev/null

```

which works with terminal access:

```julia-auto
Julia Version 1.5.2
Commit 539f3ce943* (2020-09-23 23:17 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
  WORD_SIZE: 64
  LIBM: libimf
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake

```

Here is the error when intel libraries are not in path:

```julia-auto
INTEL MKL ERROR: /usr/local/bin/../lib/julia/libmkl_core.so: cannot open shared object file: No such file or directory.
Intel MKL FATAL ERROR: Cannot load libmkl_core.so.

```

## Reproduce behaviour:

compile `julia 1.4.x - 1.7.x` with recent Intel MKL and gcc 9.2.x or up, install vscode-julia module `v1.0.10` and try to execute a julia code line within a source file opened in `vscode`

output:

```julia-auto
The terminal process "/usr/local/bin/julia '-i', '--banner=no', '--project=/home/steven/.julia/environments/v1.5', '/home/steven/.vscode/extensions/julialang.language-julia-1.0.10/scripts/terminalserver/terminalserver.jl', '/tmp/vsc-julia-repl-1970947', '/tmp/vsc-jl-cr-1970947', 'USE_REVISE=true', 'USE_PLOTPANE=true', 'DEBUG_MODE=undefined'" failed to launch (exit code: 2).

```

## Tried work around:

Tried @fredrikekre [method](https://discourse.julialang.org/t/external-julia-repl-in-vscode/50745) to run julia in an external terminal – with MKL and Intel math lib sourced, but no success.

---

<div class="post-metadata">

### Author: ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)
#### Post date: [December 22, 2020, 5:33pm UTC](https://discourse.julialang.org/t/vscode-julia-doesnt-find-intel-mkl-shared-objects/52232/2 "2020-12-22T17:33:43Z")

</div>

It seems likely your environment isn’t the same in VSCode as in your shell. Do you rely on sourcing those files in `.bashrc` or whatever to get Julia running?

---

<div class="post-metadata">

### Author: ![Steven\_Varga](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steven_varga/32/3529_2.png) [@Steven\_Varga](https://discourse.julialang.org/u/Steven_Varga)
#### Post date: [December 22, 2020, 5:49pm UTC](https://discourse.julialang.org/t/vscode-julia-doesnt-find-intel-mkl-shared-objects/52232/3 "2020-12-22T17:49:18Z")

</div>

I am using the standard `.bashrc` method, it it follows as:

```julia
source /opt/intel/bin/compilervars.sh intel64
source /opt/intel/parallel_studio_xe_2020/bin/psxevars.sh
MKL_NUM_THREADS=4
OMP_NUM_THREADS=4

```

do you happened to know a better way to do this? – or a temporary workaround?

---

<div class="post-metadata">

### Author: ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)
#### Post date: [December 22, 2020, 5:50pm UTC](https://discourse.julialang.org/t/vscode-julia-doesnt-find-intel-mkl-shared-objects/52232/4 "2020-12-22T17:50:28Z")

</div>

So the reason this doesn’t work is because we don’t go through bash to start Julia. You _should_ be able to start VSCode from within bash so that your environment is inherited though.

---

<div class="post-metadata">

### Author: ![Steven\_Varga](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steven_varga/32/3529_2.png) [@Steven\_Varga](https://discourse.julialang.org/u/Steven_Varga)
#### Post date: [December 23, 2020, 4:04am UTC](https://discourse.julialang.org/t/vscode-julia-doesnt-find-intel-mkl-shared-objects/52232/5 "2020-12-23T04:04:21Z")

</div>

Thank you for replying and pointing out. Unfortunately the suggestion doesn’t work.

Starting `code` from shell crossed my mind (didn’t work), and turned to this forum to see if anyone else is experiencing this problem. In fact it took me several weeks to understand the problem of language server not starting is rooted in julia being compiled against MKL.

Maybe someone could help me – or point me to the direction – on how to set up a debug environment with `vscode-julia` plugin, so I could identify the problem?

---

<div class="post-metadata">

### Author: ![ampbj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ampbj/32/19518_2.png) [@ampbj](https://discourse.julialang.org/u/ampbj)
#### Post date: [December 29, 2020, 8:06am UTC](https://discourse.julialang.org/t/vscode-julia-doesnt-find-intel-mkl-shared-objects/52232/6 "2020-12-29T08:06:42Z")

</div>

I am having the same problem. despite trying the suggested fix.

---

<div class="post-metadata">

### Author: ![Steven\_Varga](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steven_varga/32/3529_2.png) [@Steven\_Varga](https://discourse.julialang.org/u/Steven_Varga)
#### Post date: [December 29, 2020, 2:53pm UTC](https://discourse.julialang.org/t/vscode-julia-doesnt-find-intel-mkl-shared-objects/52232/7 "2020-12-29T14:53:57Z")

</div>

Do you happened to be familiar with TypeScript development cycle (make debug, make dist), and the way the code base is set up?

---

<div class="post-metadata">

### Author: ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)
#### Post date: [December 29, 2020, 4:42pm UTC](https://discourse.julialang.org/t/vscode-julia-doesnt-find-intel-mkl-shared-objects/52232/8 "2020-12-29T16:42:22Z")

</div>

Developing the Julia extension is super easy, just

1. Clone the repo somewhere.
2. `git submodule init`
3. Open that directory in VSCode.
4. Press F5.
5. Play around in the newly opened VSCode window.

---

<div class="post-metadata">

### Author: ![Steven\_Varga](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steven_varga/32/3529_2.png) [@Steven\_Varga](https://discourse.julialang.org/u/Steven_Varga)
#### Post date: [December 29, 2020, 6:45pm UTC](https://discourse.julialang.org/t/vscode-julia-doesnt-find-intel-mkl-shared-objects/52232/9 "2020-12-29T18:45:11Z")

</div>

Thanks! I was able to reproduce the error. I had to install `webpack-cli` to make `F5` work. Can you please let me know how to fill the directories below with the content? – for now I copied them over from a working version. But there must be a way to do this?

```julia
steven@io:/tmp/julia-vscode/scripts/packages$ tree -L 2
.
├── ChromeProfileFormat
├── CodeTracking
├── CSTParser
├── DebugAdapter
├── DocumentFormat
├── FilePathsBase
├── JSON
├── JSONRPC
├── JuliaInterpreter
├── LanguageServer
├── PackageCompiler
├── StaticLint
├── SymbolServer
├── Tokenize
├── URIParser
├── VSCodeDebugger
│ ├── Project.toml
│ ├── src
│ └── test
└── VSCodeServer
    ├── Project.toml
    ├── src
    └── test

```

---

<div class="post-metadata">

### Author: ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)
#### Post date: [December 29, 2020, 7:17pm UTC](https://discourse.julialang.org/t/vscode-julia-doesnt-find-intel-mkl-shared-objects/52232/10 "2020-12-29T19:17:22Z")

</div>

Ah, you need to `git submodule init`.

---

<div class="post-metadata">

### Author: ![Steven\_Varga](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steven_varga/32/3529_2.png) [@Steven\_Varga](https://discourse.julialang.org/u/Steven_Varga)
#### Post date: [December 29, 2020, 9:57pm UTC](https://discourse.julialang.org/t/vscode-julia-doesnt-find-intel-mkl-shared-objects/52232/11 "2020-12-29T21:57:40Z")

</div>

OK, I have a working version for MKL, with the updated environment variables – verified in `vscode`. How can I bundle `julia-vscode` and try it in my live `vscode` editor?

---

<div class="post-metadata">

### Author: ![Steven\_Varga](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steven_varga/32/3529_2.png) [@Steven\_Varga](https://discourse.julialang.org/u/Steven_Varga)
#### Post date: [December 30, 2020, 4:52am UTC](https://discourse.julialang.org/t/vscode-julia-doesnt-find-intel-mkl-shared-objects/52232/12 "2020-12-30T04:52:49Z")

</div>

In PR [#1839](https://github.com/julia-vscode/julia-vscode/pull/1839) the passed environment variable is augmented with the original `process.env` environment:

```julia
        env: Object.assign(process.env, {
            JULIA_DEPOT_PATH: path.join(...) + ':' + oldDepotPath,
          ...
        })

```

as well as the `JULIA_DEPOT_PATH` with the `oldDepotPath` and a closing `:` token so the REPL can use its default `DEPOT_PATH`.

affected files: `extensions.ts` and `interactive/repl.ts`

I am not quite certain if these updates make sense in the bigger context, please let me know if it causes any misbehaviour, etc… In any event it fixed my problems with MKL.
