PlotlyJS.jl
PlotlyJS.jl copied to clipboard
Plots don't display in Jupyter with WebIO v0.8.1
Upon updating WebIO to v0.8.1 from v0.7.0, plots no longer display/mount in Jupyter. This is reproducible (for me) in a clean environment with only IJulia and PlotlyJS added.
With ] st of
(v1.1) pkg> st
Status `~/.julia/environments/v1.1/Project.toml`
[7073ff75] IJulia v1.18.1
[f0f68f2c] PlotlyJS v0.12.3
[0f1e0344] WebIO v0.8.1
running using IJulia and plot(scatter(;y=rand(50))) doesn't show any plot. (In the Firefox developer console, running the plot cell produces a "Jupyter WebIO extension detected, not mounting.")
After pinning Webio to v0.7.0, running those same commands in jupyter does produce a plot. (And I can see several XHR requests for JS files being made which don't happen with WebIO at v0.8.1.)
I also tried this with on PlotlyJS master with WebIO v0.8.1 which didn't work (no plot).
julia> versioninfo()
Julia Version 1.1.0
Commit 80516ca202 (2019-01-21 21:24 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
Thanks @halleysfifthinc for letting us know and for doing some homework on it.
Very helpful.
perhaps @travigd or @shashi know why recent WebIO changes would have broken things?
Few diagnostic questions.
- Is this using Jupyter notebook or Jupyter lab?
- How are you launching Jupyter (e.g.
jupyter notebookcommand or from within Julia runningusing IJulia; notebook()or something else)? Have you tried restarting? - Can you produce the output of
jupyter --data-dir? That directory (for me it's/home/travigd/.local/share/jupyter) should contain annbextensionsdirectory and that directory should contain awebiodirectory.
$ ls $(jupyter --data-dir)/nbextensions/webio
main.js
Thanks!
This is in Jupyter notebook, launched from terminal with jupyter notebook. Do you mean restarting my whole computer or Jupyter? I restarted Jupyter in between the environment changes.
I have the same contents of the webio nbextension as above:
$ ls $(jupyter --data-dir)/nbextensions/webio
main.js
Hmmm... and there are no errors in the console? Can you (in the browser console) run localStorage.debug = "*" and refresh and see if there's any other output there? It should look something like this.

I don't see anything like that. This is all I see, but this is before anything is run:
WebIO:jupyter-notebook Registering WebIO node MIME type (application/vnd.webio.node+json). +0ms main.js:1:6001
WebIO:jupyter-notebook OutputArea display order: +1ms
Array(11) [ "application/vnd.webio.node+json", "application/javascript", "text/html", "text/markdown", "text/latex", "image/svg+xml", "image/png", "image/jpeg", "image/gif", "application/pdf", … ]
main.js:1:6001
WebIO:jupyter-notebook Rerendering all WebIO cells. +1ms main.js:1:6001
Hi @halleysfifthinc Are you running this in jupyterlab or the notebook?
if you are running in jupyterlab try installing the jupyterlab plotly extension as noted in the just published update to the readme of this repo.
That still doesn't quite fix the WebIO in jupyter problem (so you won't be able to do cool WebIO dependent things like update a chart was already displayed or assign julia callbacks to plot events), but at least you'll be able to see your plots
Hi @halleysfifthinc
I know this should have run on its own, but could you try again after running ]build WebIO and restarting the Jupyter server?
@sglyon, this is in Jupyter notebook, not jupyterlab. For the moment, everything is working fine for me with WebIO pinned at v0.7.0; plots show up fine with that version.
@shashi I said in the first comment that I switched between the two mentioned environments (the difference between the two being WebIO v0.7.0 and WebIO v0.8.1) and built everything (WebIO included) before starting the Jupyter server.
I have the same problem as the OP (in jupyter notebook) in v0.8.1, and working in v0.7.0.
@travigd @shashi try find me on the Julia slack if you want to more interactively debug this.
This was supposed to be solved after WebIO updated to 0.8.2. Look at this. But PlotlyJS 0.12.4 has a dependency of WebIO 0.8.1, and this needs to be updated.
@DhruvaSambrani in the Project.toml for PlotlyJS 0.12.4 it looks like the requirement is WebIO version at least 0.8.0. I don't see a 0.8.1 anywhere, could I be missing it?
If I'm not missing anything, then I suppose an up command from pkg mode should get the latest WebIO (perhaps 0.8.2 -- I'm not following release there super closely) and we can test if the latest fixes PlotlyJS?
Yes sorry, it's not a problem with PlotlyJS but instead with WebIO. They haven't released the 0.8.2 and 0.8.3 packages publicly yet. I'm opening an issue there. Let's see how it goes!
I've updated WebIO to the latest version (v0.8.4), I see
Warning: Accessing scope.id is deprecated; use scopeid(scope) instead. caller = ip:0x0 @ Core :-1
and
WebIO not detected
with no plot. Are we absolutely sure its a WebIO issue? Because other WebIO objects are rendering perfectly
might be an issue with how we use WebIO here. @travigd any idea?
The WebIO not detected method implies that nothing WebIO related is getting rendered.
If you get WebIO not detected, please...
- Update to latest WebIO (especially important for Windows - there was a fix about installing the extensions to the wrong place on Windows due to not correctly expanding path macros like
%APPDATA%) - Rebuild
WebIO - Check output of
jupyter nbextension listand see whether or not WebIO is listed there (and whether or not there's an error)
Ah - there is an issue here.
There needs to be a display method for
Base.show(::IO, ::WebIO.WEBIO_NODE_MIME, ::SyncPlot)
I thought we had some logic to try to do this automatically in WebIO (basically define a method for show(::IO, ::WEBIO_NODE_MIME, ::T) that then checks if a relevant WebIO.render(::T) method is defined) but I'm not sure. @sglyon can we chat in Slack?
If you get
WebIO not detected, please...
- Update to latest WebIO (especially important for Windows - there was a fix about installing the extensions to the wrong place on Windows due to not correctly expanding path macros like
%APPDATA%)- Rebuild
WebIO- Check output of
jupyter nbextension listand see whether or not WebIO is listed there (and whether or not there's an error)
The result of jupyter nbextension list
Known nbextensions: config dir: C:\Users\Dhruva Sambrani.jupyter\nbconfig notebook section codefolding/main enabled - Validating: ok printview/main disabled skill/main enabled - Validating: ok hinterland/hinterland enabled - Validating: ok scratchpad/main enabled - Validating: ok autosavetime/main enabled - Validating: ok skip-traceback/main disabled webio/main enabled - Validating: ok splitcell/splitcell enabled - Validating: ok collapsible_headings/main enabled - Validating: ok execute_time/ExecuteTime enabled - Validating: ok toc2/main enabled - Validating: ok notify/notify enabled - Validating: ok edit section codefolding/edit enabled - Validating: ok config dir: c:\program files\python37\etc\jupyter\nbconfig notebook section jupyter-js-widgets/extension enabled - Validating: ok config dir: C:\ProgramData\jupyter\nbconfig notebook section nbextensions_configurator/config_menu/main enabled - Validating: problems found: - require? X nbextensions_configurator/config_menu/main contrib_nbextensions_help_item/main enabled - Validating: ok tree section nbextensions_configurator/tree_tab/main enabled - Validating: problems found: - require? X nbextensions_configurator/tree_tab/main
thanks for working on this issue!
I tried to switch to @travigd 's WebIO branch https://github.com/JuliaGizmos/WebIO.jl/tree/td/add-register-renderable-macro
Unfortunately, I still can not see any plot, I got this message in the browser console:
Jupyter WebIO nbextension detected; not loading ad-hoc.
VM1369:3 Jupyter WebIO extension detected, not mounting.
(v1.0) pkg> st
Status `/usr/opt/julia-1.0.4/local/share/julia/environments/v1.0/Project.toml`
[c7e460c6] ArgParse v0.6.2
[c2a8506f] BigArrays v0.8.0+ [`/usr/opt/julia-1.0.4/local/share/julia/dev/BigArrays`]
[336ed68f] CSV v0.5.5
[aaaa29a8] Clustering v0.13.1
[35d6a980] ColorSchemes v3.3.0
[3da002f7] ColorTypes v0.8.0
[5ae59095] Colors v0.9.5
[d58978e5] Dagger v0.8.0
[a93c6f00] DataFrames v0.18.3
[7806a523] DecisionTree v0.8.1
[b4f34e82] Distances v0.8.0
[5789e2e9] FileIO v1.0.7
[53c48c17] FixedPointNumbers v0.6.1
[4d00f742] GeometryTypes v0.7.5
[f67ccb44] HDF5 v0.11.1
[7073ff75] IJulia v1.18.1
[6218d12a] ImageMagick v0.7.4
[033835bb] JLD2 v0.1.2
[682c06a0] JSON v0.20.0
[a93385a2] JuliaDB v0.12.0
[6f286f6a] MultivariateStats v0.6.0
[b8a86587] NearestNeighbors v0.4.3
[9b87118b] PackageCompiler v0.6.4+ [`/usr/opt/julia-1.0.4/local/share/julia/dev/PackageCompiler`]
[58dd65bb] Plotly v0.2.0
[f0f68f2c] PlotlyJS v0.12.4
[91a5bcdd] Plots v0.25.1
[92933f4c] ProgressMeter v1.0.0
[438e738f] PyCall v1.91.2
[d330b81b] PyPlot v2.8.1
[a8468747] QHull v0.1.0
[1a8c2f83] Query v0.11.0
[6f49c342] RCall v0.13.2
[4491297b] RealNeuralNetworks v0.8.0+ [`/usr/opt/julia-1.0.4/local/share/julia/dev/RealNeuralNetworks`]
[295af30f] Revise v2.1.6
[3646fa90] ScikitLearn v0.5.0
[2913bbd2] StatsBase v0.30.0
[0796e94c] Tokenize v0.5.4
**[0f1e0344] WebIO v0.8.5 [`/usr/opt/julia-1.0.4/local/share/julia/dev/WebIO`]**
[8ba89e20] Distributed
[37e2e46d] LinearAlgebra
[10745b16] Statistics
I am having a similar issue. No plot shows up in my Jupyter notebooks. Any advice on what to do?
[f0f68f2c] PlotlyJS v0.12.4
jupyter nbextension list
Known nbextensions:
config dir: /Users/.../.jupyter/nbconfig
notebook section
webio/main enabled
- Validating: OK
config dir: /Users/.../anaconda3/etc/jupyter/nbconfig
notebook section
jupyter-js-widgets/extension enabled
- Validating: OK
julia> versioninfo()
Julia Version 1.1.1
Commit 55e36cc (2019-05-16 04:10 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin15.6.0)
CPU: Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
Command to start notebook:
using IJulia; notebook(dir=".")
In the Chrome developer console:

Screenshot of notebook:

#285 addresses this problem and has been merged. Would people here be willing to test out the latest master?
I could not reproduce the issue, so having another test would be helpful (Thanks @travigd for the fix and @DhruvaSambrani for testing already)!
Either when I get another positive report or a day or two has passed I'll release a new version, whichever happens first
Thanks!
Let me give it a try!
Happy to report this is working now! Problem fixed. Here are some screenshots. There are still a couple of minor warnings but it looks benign.

┌ Info: Recompiling stale cache file /Users/.../.julia/compiled/v1.1/PlotlyJS/1r9Ld.ji for PlotlyJS [f0f68f2c-4968-5e81-91da-67840de0976a]
└ @ Base loading.jl:1184
WARNING: could not import Base.quit into AtomShell
Chrome Console messages

Julia Version 1.1.1 macOS (x86_64-apple-darwin15.6.0)
Thanks!
The example works for me too, but not for my more complex app :disappointed:. The console shows this:
Use of Mutation Events is deprecated. Use MutationObserver instead. jquery.min.js:5
actions jupyter-notebook:find-and-replace does not exist, still binding it in case it will be defined later... menubar.js:304
accessing "actions" on the global IPython/Jupyter is not recommended. Pass it to your objects contructors at creation time main.js:208
Loaded moment locale en-ca bidi.js:19
load_extensions
Arguments { 0: "jupyter-js-widgets/extension", 1: "webio/main", … }
utils.js:60
Session: kernel_created (857d86c7-b019-4b2d-8760-e1fb7a16e5b8) session.js:54
Starting WebSockets: ws://magneto:8897/api/kernels/165d228e-6e6b-42fc-9333-0f34d5017287 kernel.js:459
WebIO is registering SystemJS window global. main.js:1:39743
Loading extension: webio/main utils.js:37
Loading extension: jupyter-js-widgets/extension utils.js:37
setTimeout executed 0 main.js:1:125191
Kernel: kernel_connected (165d228e-6e6b-42fc-9333-0f34d5017287) kernel.js:103
Kernel: kernel_ready (165d228e-6e6b-42fc-9333-0f34d5017287) kernel.js:103
WebIO detected Jupyter notebook environment. main.min.js:14:17
Jupyter WebIO nbextension detected; not loading ad-hoc. main.min.js:23:21
WebIO detected Jupyter notebook environment. main.min.js:14:17
Jupyter WebIO nbextension detected; not loading ad-hoc. main.min.js:23:21
Jupyter WebIO extension detected, not mounting.
main.min.js:2:17
WebIO detected Jupyter notebook environment. main.min.js:14:17
Jupyter WebIO nbextension detected; not loading ad-hoc. main.min.js:23:21
Jupyter WebIO extension detected, not mounting.
main.min.js:2:17
Source map error: request failed with status 404
Resource URL: http://magneto:8897/static/components/proptypes/index.js?v=c40890eb04df9811fcc4d47e53a29604
Source Map URL: index.js.map
Source map error: request failed with status 404
Resource URL: http://magneto:8897/static/components/preact/index.js?v=00a2fac73c670ce39ac53d26640eb542
Source Map URL: preact.min.js.map
Source map error: request failed with status 404
Resource URL: http://magneto:8897/static/components/preact-compat/index.js?v=f865e990e65ad27e3a2601d8adb48db1
Source Map URL: preact-compat.min.js.map
The last three errors seem unrelated? When I paste the URLs in the browser it works fine.
I did the ritual: build WebIO PlotlyJS; restart notebook server; restart browser.
Grr I thought we had solved this one.
Is there any way you can create a minimal example from your more complex app that we could look at?
It’s hard to diagnose without seeing code
@cstjean are you using it with Plots? That still doesn't work
No, I'm using it directly, but it's fairly involved. I'll do a MWE when I get the time, which might be in September...
Hi - I still get the same error. This is a fresh install of Julia. I've tried upgrading Jupyterlab, building Webio - still nothing shows.

Actually - it works in Jupyter notebook, but not in Jupyterlab. Also, as Dhruva said - it works only if used directly, but not via Plots.