Sysimage + vscode

Are there any known problems specific to running VS code with your own sysimage?

I have a “research” environment that I use a lot. Running the includes takes a long time, and then compiling functions for the first time also takes a long time. Since the “things I do a lot and don’t change” and the “things that take a long time the first time around” are the same, I thought this would be a good candidate for a sysimage.

I followed the walkthru here [1]. I did the “Creating a sysimage using PackageCompiler” and “Compilation of functions” sections, so I provided a precompile_scripts.jl representative of “things I do a lot”. The only thing I did different was that I called create_image with nothing in the first arg, because code says that in that case all packages in the environment will be included, you can see the this is allowed here [2].

Once the process is finished I run myjuliapath --sysimage=myimagepath from the command line and it works. On the Repl I check that the default Base.loaded_modules and verified that everything is there. Great!

Now on VS code, my config is very simple. I just set the Julia Executable Path to

myjuliapath -t 30

To use the new sysimage I replaced this on VS code with

myjuliapath -t 30 --sysimage=myimagepath

However, when I make this change the VS code Repl won’t start. I keep getting a pop-up saying

Julia Language Server client: couldn’t create connection to server

Keep in mind that I can literally copy paste the above VS code Julia Executable Path into the command line, and it works fine. So the problem isn’t that path.

It occurred to me that maybe VS code expects something that isn’t present on my sysimage, somehow? Are there any known problems with the workflow I described? Julia version 1.12.0-rc1 if that matters.

EDIT: I’ve found other posts asking about this set up but haven’t found the responses helpful [3] [4]. [4] in particular mentions that “that feature was removed” - I hope it’s referring to the feature of “automatically using sysimages from the project folder”, not using sysimages in VS code…

[1] Sysimages · PackageCompiler

[2] PackageCompiler.jl/src/PackageCompiler.jl at 57505caad062b5b1985bcbbb2fb15b9b6e9e6d99 · JuliaLang/PackageCompiler.jl · GitHub

[3] Sysimage with workload in VSCode? [Mar 2021]

[4] VS code and Juila system image? [Oct 2024]

2 Likes