-
-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] No plot output from Plots with plotly() backend within Jupyter Notebook (>= ver. 7.00) and VS Code's Notebook #4827
Comments
I run into this problem too, and I found that if I wait for enough time since I run some plotting, interrupt the kernel TWICE would make the output appear, and with no errors/warnings. |
I tried yourmethod on my Windows installation, but I could not make the plot output appear. I tried plotting with Plots with plotly() backend; then waited a minute; then clicked on the "interrupt kernal" button twice, and still nothing appeared. |
Today I tried using VSCode with the Julia extension to create a notebook. I then installed PlotyJS package via: using Pkg; Pkg.add("PlotlyJS"). One very strange thing that I noticed in VSCode's notebook was that if I first used plotlyjs() backend to create a plot, and then switched backend to plotly(), the plotly() backend started working! EDIT: I have now discovered that if I install PlotlyBase as well as Plots, then using Plots with plotly() backend always works in VS Code. PlotlyBase is the "plot-making guts of PlotlyJS.jl". Its installation must somehow change something when Plots is used with plotly() backend (even though one does not explicitly load PlotlyBase). This does not solve the problem within Jupyter Notebook. I hope that someone can assist in fixing this bug. |
The plotly() problem is also present with other versions of Julia on Windows. I created fresh installations of Julia LTS v1.6.7 and v1.10.0 beta 3, and then installed IJulia and Plots. On Windows, Plots with plotly() backend shows no output in Jupyter notebook. In VS Code's notebook, plotly() backend only shows an output if PlotlyBase is also installed (perhaps this is meant to be so). EDIT I currently think that the plotly() problem in Jupyter may be with the version of conda and/or Jupter Notebook that is installed by IJulia on Windows machines. I placed a bug report (with more details) on the IJulia github page: |
After further investigation, I have concluded that the problem is related to an incompatibility with the the current version of Jupyter Notebook that is installed by IJulia. To see which version of Jupyter Notebook one is using: Plotly() backend does not work in the current version of Jupyter Notebook being 7.0.6 (or any version from 7.0.0 onwards) The last version of the notebook that works with plotly() backend is version 6.5.7 (tested 2024-09-14). To reproduce the problem on Windows. Install packages IJulia and Plots: using Pkg; Then at the Julia prompt, execute: It will then ask the question: The browser tab opens with Jupyters' filemanager. One can then open a notebook. HERE IS A TEMPORARY SOLUTION: Use conda to install "jupyter 6.x.x" (the last version that works with plotly() backend) as follows:
Now you can try to open a new Jupyter notebook (which should be version 6.5.x) and it should work with Plots and plotly() backend. Note: You can see all available versions of the notebook package via typing at the julia prompt:
Now that I have finally found the problem and a temporary solution, I hope that someone can make current versions of IJulia+Plots+plotly() work correctly with the current version of Jupyter Notebook. (The problem may be with Jupyter Notebook or it may have something to do with the html code that is produced from plotly() within the notebook. A saved html file has missing header information which means it cannot be later viewed in a web-browser - see my comment on 14 September 2023 on JuliaLang/IJulia.jl#1094) |
[UPDATE 2023-11-09: The problem of plotly() backend not displaying plots within Jupyter Notebook started with the release of Jupyter Notebook version 7.xx (which is installed by IJulia). See my comment further down on 9 November which gives a temporary solution via installation of an older version of Jupyter Notebook, version 6.5.7]
Original Bug report:
The plotly() backend of Plots does not does not display a plot within Jupyter notebook running on Windows [and also confirmed on MAC as reported by @gmantegna].
The bug is present on MS Windows 11/10 running Julia 1.9.3 [and LTS 1.6.7 and 1.10 beta], IJulia 1.24.2 and Plots 1.39.0 [fresh installation].
[Edit: The problem also exists in VS Code's notebook in Windows.]
The following code displays a blank space instead of the plot.
using Plots
plotly()
display(plot(rand(10)))
If I use the gr() backend, the plot output does display in the notebook.
If I use Plots with plotly() from the command line REPL, it does work - a tab on my browser opens and displays the plot.
Oddly, on my Ubuntu Linux 23.04 installation, running the same version of Julia and packages [Edit: I later realised with an older version of Jupyter 6.4.12], the plotly() backend does work in Jupyter Notebook. The problem is however definitely present on Windows and MAC - I have tested on three different Windows PCs with fresh installations (I deleted any previous ".julia" folder].
The problem is similar to an earlier issue that was closed on 4 June 2023.
"Not seeing any output after running plotly() with julia 1.9" JuliaLang/IJulia.jl#1073
and also reported here
#4739
I have also created a bug report (with more details) on the IJulia github page:
JuliaLang/IJulia.jl#1094
The text was updated successfully, but these errors were encountered: