PlotlyJS backend not working in Jupyter Notebook on VS Code

The following code:

using Plots
plotlyjs()
plot(rand(10,4),rand(10,4),rand(10,4))

Runs perfectly fine as a .jl in my vscode environment, but the same code just runs forever when inside of a Jupyter notebook in VS Code. Any ideas on how how to fix this?

IJulia v1.24.0
Plotly v0.4.1
PlotlyJS v0.18.10
Plots v1.38.7

Are you using the same Julia environment in both cases?

Can you run other commands in the Jupyter notebook?

Yes, it’s the same environment. I have been using Jupyter for everything, and have yet to come across anything that doesn’t work in Jupyter but works in REPL.

I’ve had trouble getting plotlyjs() to run as the backend in VSCode Jupyter notebook. It does run from the REPL without issue.

My packages are:
PlotlyJS v0.18.10
Plots v1.38.12
StatsPlots v0.15.5

I did have IJulia and Conda installed but couldn’t use plotlyhs at all in vscode jupyter. I removed those, and now on first load of VSCode, I can set plotlyjs() as the backend inside a jupyter notebook and plot with Plots (or StatsPlots). I can run as many plots as I like in the notebook. Once I close VSCode and reload later, plotlyjs() just runs forever and no plots show. If I reboot, and load VSCode, they’ll plot again until I close. Then I can’t plot until I reboot.

This works fine on my reference deployment using the JupyterLab Julia docker stack:


OS: Debian 11 (bullseye), Architecture: x86_64
code-server v4.13.0 (aka Code v1.78.2)
Code Jupyter extension v2023.3.100
Code Julia extension v1.47.2
Julia v1.9.0

IJulia v1.24.0
PlotlyJS v0.18.10
Plots v1.38.14


What makes this project different:

  1. Multi-arch: linux/amd64, linux/arm64/v8
  2. Base image: Debian instead of Ubuntu
  3. IDE: code-server next to JupyterLab
  4. Just Python – no Conda / Mamba

I’m also having the same issue. The following giving output in REFL

using Plots
plotlyjs()
plot(sin, (x->begin
            sin(2x)
        end), 0, 2π, line = 4, leg = false, fill = (0, :orange))

But in Jupyter Notebook it’s continuing to run on and if I interrupt the kernel it’s giving output.

I’m using Julia 1.9.0 and have the following packages.

[0c46a032] DifferentialEquations v7.7.0
[28b8d3ca] GR v0.72.7
[7073ff75] IJulia v1.24.2
[f0f68f2c] PlotlyJS v0.18.10
[91a5bcdd] Plots v1.38.15
[f2b01f46] Roots v2.0.17

Apparently this issue hasn’t gone away. I’m using VSCode and the latest Julia version and packages as of 10/20/23: Julia 1.9.3, IJulia 1.24.2, PlotlyJS 0.18.11, and Plots 1.39.0. The using PlotlyJS statement never returns. Any help would be appreciated.

1 Like