# Using an ITensors sysimage when starting the Julia REPL in VS Code?

**URL:** https://discourse.julialang.org/t/using-an-itensors-sysimage-when-starting-the-julia-repl-in-vs-code/98625
**Category:** New to Julia
**Tags:** vscode, sysimage, itensors
**Created:** [May 10, 2023, 3:28pm UTC](https://discourse.julialang.org/t/using-an-itensors-sysimage-when-starting-the-julia-repl-in-vs-code/98625 "2023-05-10T15:28:24Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Ludwig\_Hruza](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ludwig_hruza/32/49669_2.png) [@Ludwig\_Hruza](https://discourse.julialang.org/u/Ludwig_Hruza)
#### Post date: [May 10, 2023, 3:28pm UTC](https://discourse.julialang.org/t/using-an-itensors-sysimage-when-starting-the-julia-repl-in-vs-code/98625/1 "2023-05-10T15:28:24Z")

</div>

Hi, I am using the library ITensors, which suggests on its website ([Running ITensor and Julia Codes · ITensors.jl](https://itensor.github.io/ITensors.jl/dev/getting_started/RunningCodes.html#Compiling-an-ITensor-System-Image)) to generate a sysimage for faster startup times

```julia
julia> using ITensors; ITensors.compile()

```

In a terminal, this can be loaded if I start julia with the extension

```julia
$ julia --sysimage ~/.julia/sysimages/sys_itensors.so

```

Question: I would like the Julia REPL in VS Code to automatically start Julia in this way, that is, using the ITensors sysimage. How do I do this?

Follow up question: I am using a Jupyter notebooks in VS Code with a Julia Kernel. How can I tell Kernel that it should load the ITensors sysimage when it starts?

---

<div class="post-metadata">

### Author: ![TI36XPro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ti36xpro/32/33658_2.png) [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)
#### Post date: [May 10, 2023, 3:33pm UTC](https://discourse.julialang.org/t/using-an-itensors-sysimage-when-starting-the-julia-repl-in-vs-code/98625/2 "2023-05-10T15:33:55Z")

</div>

Have a look [here](https://www.julia-vscode.org/docs/dev/userguide/compilesysimage/#Compiling-Sysimages). That’s how I start my VSCode Julia sessions.

Not sure about the Jupyter notebook question.

---

<div class="post-metadata">

### Author: ![DrPapa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drpapa/32/6835_2.png) [@DrPapa](https://discourse.julialang.org/u/DrPapa)
#### Post date: [May 11, 2023, 1:21pm UTC](https://discourse.julialang.org/t/using-an-itensors-sysimage-when-starting-the-julia-repl-in-vs-code/98625/3 "2023-05-11T13:21:02Z")

</div>

> [@Ludwig\_Hruza](#):
>
> Follow up question: I am using a Jupyter notebooks in VS Code with a Julia Kernel. How can I tell Kernel that it should load the ITensors sysimage when it starts?

You need to add a custom kernel to Jupyter. Below will add a kernel called “julia\_ITensors”

```julia
using IJulia
installkernel("julia_ITensors","--sysimage=~/.julia/sysimages/sys_itensors.so")

```

See: [Installation · IJulia](https://julialang.github.io/IJulia.jl/stable/manual/installation/#Installing-additional-Julia-kernels)

---

<div class="post-metadata">

### Author: ![Ludwig\_Hruza](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ludwig_hruza/32/49669_2.png) [@Ludwig\_Hruza](https://discourse.julialang.org/u/Ludwig_Hruza)
#### Post date: [May 12, 2023, 12:52pm UTC](https://discourse.julialang.org/t/using-an-itensors-sysimage-when-starting-the-julia-repl-in-vs-code/98625/4 "2023-05-12T12:52:02Z")

</div>

Thanks. The custom kernal for Jupyter works great.

However, considering my original question. If I follow the advice by TI23XPRO, I need to first create a project environment, then build a custom sysimage that is saved in the same project folder and then VSC is supposed to automatically find it. However, if I don’t want to create an environment and a custom sysimage of this environment (which might also include other packages), how to I tell VSC to consider the sysimage `sys_itensors.so` in my `.julia/sysimages` folder?

---

<div class="post-metadata">

### Author: ![DrPapa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drpapa/32/6835_2.png) [@DrPapa](https://discourse.julialang.org/u/DrPapa)
#### Post date: [May 16, 2023, 9:34pm UTC](https://discourse.julialang.org/t/using-an-itensors-sysimage-when-starting-the-julia-repl-in-vs-code/98625/5 "2023-05-16T21:34:28Z")

</div>

add `"--sysimage ~/.julia/sysimages/sys_itensors.so"` as an argument per [How to launch Julia with command-line arguments in VS Code? - #2 by BenPH](https://discourse.julialang.org/t/how-to-launch-julia-with-command-line-arguments-in-vs-code/93716/2)

---

<div class="post-metadata">

### Author: ![miles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles/32/29112_2.png) [@miles](https://discourse.julialang.org/u/miles)
#### Post date: [May 22, 2023, 10:24pm UTC](https://discourse.julialang.org/t/using-an-itensors-sysimage-when-starting-the-julia-repl-in-vs-code/98625/6 "2023-05-22T22:24:14Z")

</div>

Thanks @DrPapa and @TI36XPro . We are adding the information above to the ITensor docs.

---

<div class="post-metadata">

### Author: ![swanchristmas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/swanchristmas/32/202550_2.png) [@swanchristmas](https://discourse.julialang.org/u/swanchristmas)
#### Post date: [October 18, 2023, 10:51am UTC](https://discourse.julialang.org/t/using-an-itensors-sysimage-when-starting-the-julia-repl-in-vs-code/98625/7 "2023-10-18T10:51:08Z")

</div>

Hi miles, I followed the instruction as mentioned above while get error:

```julia
The terminal process "C:\Users\swan\AppData\Local\Programs\Julia-1.9.3\bin\julia.exe '-i', '--banner=no', '--project=C:\Users\swan\.julia\environments\v1.9', '--sysimage ~/.julia/sysimages/sys_itensors.so', 'c:\Users\swan\.vscode\extensions\julialang.language-julia-1.54.2\scripts\terminalserver\terminalserver.jl', '\\.\pipe\vsc-jl-repl-33df9511-9f4e-42c8-a0e8-23f4a9e10148', '\\.\pipe\vsc-jl-cr-02a5deaf-bbd0-4c46-87d9-86cc652f3458', 'USE_REVISE=true', 'USE_PLOTPANE=true', 'USE_PROGRESS=true', 'ENABLE_SHELL_INTEGRATION=true', 'DEBUG_MODE=false'" terminated with exit code: 1.

```

I start REPL by `ctrl+Shift+P` and `Julia: Start REPL`.

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [October 18, 2023, 11:51pm UTC](https://discourse.julialang.org/t/using-an-itensors-sysimage-when-starting-the-julia-repl-in-vs-code/98625/8 "2023-10-18T23:51:57Z")

</div>

Can you run that command from a terminal?

---

<div class="post-metadata">

### Author: ![swanchristmas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/swanchristmas/32/202550_2.png) [@swanchristmas](https://discourse.julialang.org/u/swanchristmas)
#### Post date: [October 19, 2023, 6:58am UTC](https://discourse.julialang.org/t/using-an-itensors-sysimage-when-starting-the-julia-repl-in-vs-code/98625/9 "2023-10-19T06:58:43Z")

</div>

Good news! It works by changing the argument in `"julia.additionalArgs"` to `"--sysimage=.\\.julia\\sysimages\\sys_itensors.so"`. (Windows system)
