That is very strange, I actually don’t see how “our” kernel could not show up if the REPL works and the notebook setting is turned on…
Here are my installed extensions and a simple line evaluated in a regular jl file in the same VSCode instance:
Both ipynb and jl files work fine by themselves, but the ipynb stuff seems to just be a combination of Jupyter extension + IJulia that is completely unaware of any Julia VSCode extension functionality related to notebooks…
Can you double-check that julia.notebookController
is true
in all relevant places (it’s possible you accidentally set it for a remote machine or something like that).
These days I don’t actually use dev
much when I’m developing local packages. After I realized that I can put scripts in an examples
or scripts
folder adjacent to the src
directory and run code in them without having to dev
my package, I stopped using dev
.
So in other words, it would be nice if indexing/static analysis still worked for local packages even if they haven’t been dev
-ed.
Yes, we will use our static analysis on the currently open package in the workspace always, so this question on whether to locally index is really just relevant for code that sits outside the folder you have open in VS Code.
I don’t use remote machines - I set it in the settings GUI, and checked the settings.json
to confirm. I’m not at that computer anymore though unfortunately, but fwiw I just tried it on a Manjaro machine at home and it still doesn’t seem to work:
settings.json
Kernel list is completely empty (I don’t have IJulia
on this machine):
Installed extensions and succesful inline evaluation of some code:
On this machine, the path to Julia is empty and
[nils@nils-2560p ~]$ which julia
/usr/bin/julia
[nils@nils-2560p ~]$ readlink -f /usr/bin/julia
/home/nils/bin/Julia/julia-1.6.1/bin/julia
I feel like I’m missing some step somewhere, but from David’s JuliaCon talk it seemed that there aren’t any other than having the two extensions installed!?
Hm, you are getting the “old” Jupyter notebook interface that was implemented in the Jupyter extension, not the new native notebook UI that ships as part of VS Code. I thought MS had rolled out the new UI for everyone, so I’m slightly confused what is going on there…
You could try these settings. Those were necessary before MS rolled this out to everyone, so shouldn’t be anymore, but who knows?
Sorry I can’t seem to find a specific setting to try on the page you linked, could you clarify?
I’ve re-installed VSCode but that didn’t help unfortunately.
I only got the latest features (and the same look as in the JuliaCon video) when I installed VS Code Insiders (which is also the first step in the documentation of the Jupyter extension )
Now I have the new look, and after re-enabling the Notebook Controller setting, I get the VSCode extension kernel, which also gives me the notebook variable workspace.
The next step is to get multiple threads working. It appears that the vscode kernel does not yet respect the “julia.NumThreads” setting.
That sorted it - on Insiders I am getting the new look, and the Julia VS Code kernels show up! This also means that DataFrames now show correctly (they were shown as plain text LaTeX by the kernels I had installed through IJulia), although plots look a bit funny now (they stretch across the whole notebook irrespective of their actual width).
I am finding that calling sin([1.])
(wrong syntax), ?sin
or ]st
in a cell in the new native notebook all return the error
Stacktrace:
[1] top-level scope
@ ~/OneDrive/Code/gaussianODEs/notebooks/importtest.ipynb:1
[2] eval
@ ./boot.jl:360 [inlined]
[3] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
@ Base ./loading.jl:1094
[4] include_string(m::Module, txt::String, fname::String)
@ Base ./loading.jl:1104
[5] #invokelatest#2
@ ./essentials.jl:708 [inlined]
[6] invokelatest
@ ./essentials.jl:706 [inlined]
[7] (::VSCodeServer.var"#98#99"{VSCodeServer.NotebookRunCellArguments, String})()
@ VSCodeServer ~/.vscode-insiders/extensions/julialang.language-julia-insider-1.3.27/scripts/packages/VSCodeServer/src/serve_notebook.jl:15
[8] withpath(f::VSCodeServer.var"#98#99"{VSCodeServer.NotebookRunCellArguments, String}, path::String)
@ VSCodeServer ~/.vscode-insiders/extensions/julialang.language-julia-insider-1.3.27/scripts/packages/VSCodeServer/src/repl.jl:185
[9] otebook_runcell_request(conn::VSCodeServer.JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, params::VSCodeServer.NotebookRunCellArguments)
@ VSCodeServer ~/.vscode-insiders/extensions/julialang.language-julia-insider-1.3.27/scripts/packages/VSCodeServer/src/serve_notebook.jl:14
[10] dispatch_msg(x::VSCodeServer.JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, dispatcher::VSCodeServer.JSONRPC.MsgDispatcher, msg::Dict{String, Any})
@ VSCodeServer.JSONRPC ~/.vscode-insiders/extensions/julialang.language-julia-insider-1.3.27/scripts/packages/JSONRPC/src/typed.jl:67
[11] serve_notebook(pipename::String; crashreporting_pipename::String)
@ VSCodeServer ~/.vscode-insiders/extensions/julialang.language-julia-insider-1.3.27/scripts/packages/VSCodeServer/src/serve_notebook.jl:91
[12] top-level scope
@ ~/.vscode-insiders/extensions/julialang.language-julia-insider-1.3.27/scripts/notebook/notebook.jl:10
[13] include(mod::Module, _path::String)
@ Base ./Base.jl:386
[14] exec_options(opts::Base.JLOptions)
@ Base ./client.jl:285
[15] _start()
@ Base ./client.jl:485
Am I doing something wrong, or should I open an issue about this?
No, that’s expected atm. We should handle parse errors better though (and crop backtraces properly).
Same result. Only worked on VS code Insiders. The reason is probably that currently the Jupyter
extension only works on Insiders.
Same issue, but it has nothing to do with VS Code Julia extension.
- Reason: The default output format (of
Plots
) issvg
for backends that support it (doc). However, it seems the currentJupyter
cannot render SVG properly. - Workaround: plot in
png
format by specifying thefmt
parameter.
plot(Ebat; size=(500, 400), fmt=:png, label="Ebat")
- Better solution: it can be tedious to write
fmt=:png
for every plot call. You can change the global default setting instead. At the beginning of your notebook, type
default(fmt=:png)
Check julia - How to set the default attributes of Plots? - Stack Overflow for more details.
Can someone help on installing/using the new Jupyter vscode experience?
I have vscode 1.58.2 installed on Linux. I have installed the “Jupyter extension”. However, that does not seem to be what is being mentioned here. For instance, I have to choose which kernel to run, and my Julia install (1.6.2) is not available:
Seems to me that I am running some legacy extension, but I’m not sure what to do.
What exactly one must do to install the new extension in Vscode?
Did you enable the native notebook support in the Julia extension via the setting I mentioned above?
No, I had not (I was following the instructions from your JuliaCon talk ) . Now I did, and the correct kernel appears. Still, I don’t know where those other kernels are coming from (maybe some old jupyter installation I had somewhere?)
But it is working now, thanks.
Maybe this is unrelated to the extension, but is there any particular reason for the commands being much more responsive in the REPL than in the notebook? Note the loading times:
while:
So these other kernels are surfaced from the Jupyter extension, and it is looking for “traditional” kernels that you installed at some point via IJulia.jl. You could just disable the Jupyter extension and then they wouldn’t show. I think they also plan to hide the IJulia kernels in some future version, once we ship our notebook support without the flag.
The load times are interesting, not sure right now… It might be precompile stuff, or some inefficiency in our communication method or something like that. Could you maybe open an issue, we should try to get to the bottom of that!
Thanks for the help. Unfortunately I don’t know even where to start here. If I open the VScode again the correct kernel got lost again (with the vscode extension ticked). And it just took me 50s for building a plot…
(also when I tried to export the notebook to HTML I got an error which got solved by installing the Python language server, but now the Julia Language server is broken… ).
For now I will have to stop experimenting to actually finish a report. If I manage to actually have a reproducible set or problems I will post an issue accordingly.
Yeah, the experience is rough right now… When I recorded the Juliacon video I thought we would be able to iron it all out before Juliacon, but then it turned out we couldn’t, and that is why we hid the feature behind a configuration option: we felt it was not really ready for everyone and needs a bit more work to smooth out before we ship it by default. If you need to finish something: don’t use it yet!