Skip to content
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

Plots don't display in Jupyter with WebIO v0.8.1 #278

Closed
halleysfifthinc opened this issue Apr 15, 2019 · 41 comments · Fixed by #285
Closed

Plots don't display in Jupyter with WebIO v0.8.1 #278

halleysfifthinc opened this issue Apr 15, 2019 · 41 comments · Fixed by #285

Comments

@halleysfifthinc
Copy link

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)
@sglyon
Copy link
Member

sglyon commented Apr 16, 2019

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?

@twavv
Copy link
Contributor

twavv commented Apr 16, 2019

Few diagnostic questions.

  • Is this using Jupyter notebook or Jupyter lab?
  • How are you launching Jupyter (e.g. jupyter notebook command or from within Julia running using 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 an nbextensions directory and that directory should contain a webio directory.
$ ls $(jupyter --data-dir)/nbextensions/webio
main.js

Thanks!

@halleysfifthinc
Copy link
Author

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

@twavv
Copy link
Contributor

twavv commented Apr 16, 2019

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.

Screenshot from 2019-04-16 11-31-56

@halleysfifthinc
Copy link
Author

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

@sglyon
Copy link
Member

sglyon commented Apr 19, 2019

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

@shashi
Copy link

shashi commented Apr 19, 2019

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?

@halleysfifthinc
Copy link
Author

@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.

@JobJob
Copy link
Contributor

JobJob commented May 3, 2019

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.

@DhruvaSambrani
Copy link

DhruvaSambrani commented Jun 1, 2019

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.

@sglyon
Copy link
Member

sglyon commented Jun 1, 2019

@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?

@DhruvaSambrani
Copy link

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!

@DhruvaSambrani
Copy link

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

@sglyon
Copy link
Member

sglyon commented Jun 7, 2019

might be an issue with how we use WebIO here. @travigd any idea?

@twavv
Copy link
Contributor

twavv commented Jun 7, 2019

The WebIO not detected method implies that nothing WebIO related is getting rendered.

@twavv
Copy link
Contributor

twavv commented Jun 7, 2019

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 list and see whether or not WebIO is listed there (and whether or not there's an error)

@twavv
Copy link
Contributor

twavv commented Jun 7, 2019

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?

@DhruvaSambrani
Copy link

DhruvaSambrani commented Jun 8, 2019

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 list and 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

@jingpengw
Copy link

jingpengw commented Jun 19, 2019

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 

@ghuba
Copy link
Contributor

ghuba commented Jun 27, 2019

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:

image

Screenshot of notebook:

image

@sglyon
Copy link
Member

sglyon commented Jun 28, 2019

#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!

@sglyon sglyon reopened this Jun 28, 2019
@ghuba
Copy link
Contributor

ghuba commented Jun 28, 2019

Let me give it a try!

@ghuba
Copy link
Contributor

ghuba commented Jun 28, 2019

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.

image

┌ 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

image

Julia Version 1.1.1
macOS (x86_64-apple-darwin15.6.0)

@sglyon
Copy link
Member

sglyon commented Jun 28, 2019

Thanks!

@sglyon sglyon closed this as completed Jun 28, 2019
@cstjean
Copy link
Contributor

cstjean commented Jul 10, 2019

The example works for me too, but not for my more complex app 😞. 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.

@sglyon
Copy link
Member

sglyon commented Jul 10, 2019

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

@DhruvaSambrani
Copy link

@cstjean are you using it with Plots? That still doesn't work

@cstjean
Copy link
Contributor

cstjean commented Jul 11, 2019

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...

@gurvesh
Copy link

gurvesh commented Jul 22, 2019

Hi - I still get the same error. This is a fresh install of Julia. I've tried upgrading Jupyterlab, building Webio - still nothing shows.

Screenshot from 2019-07-22 22-14-44

@gurvesh
Copy link

gurvesh commented Jul 22, 2019

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

@Masacroso
Copy link

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

it doesn't work in classical jupyter notebook either. I tried now in a jupyter notebook this code

using PlotlyJS
function area1()
    trace1 = scatter(;x=1:4, y=[0, 2, 3, 5], fill="tozeroy")
    trace2 = scatter(;x=1:4, y=[3, 5, 1, 7], fill="tonexty")
    plot([trace1, trace2])
end

But when I executed area1() it just show an empty cell. Context: Julia 1.1.1, IJulia 1.18.1, PlotlyJS 0.12.4 and WebIO 0.8.5. In windows 10 64 bits.

@DhruvaSambrani
Copy link

DhruvaSambrani commented Jul 26, 2019

But when I executed area1() it just show an empty cell. Context: Julia 1.1.1, IJulia 1.18.1, PlotlyJS 0.12.4 and WebIO 0.8.5. In windows 10 64 bits.

@Masacroso you need to update to PlotlyJS 0.12.5

@xiaodaigh
Copy link

getting the same issues now ungrade doesn't work

@mananbordia
Copy link

mananbordia commented Apr 2, 2021

Executed plot in Jupyter Notebook but gives blank output. What to do ?

@empet
Copy link

empet commented Apr 2, 2021

What Julia and PlotlyJS.jl version are you working with?

@mananbordia
Copy link

PlotlyJS => v"0.14.1"
Julia => v"1.4.2"

@empet
Copy link

empet commented Apr 2, 2021

It works with Julia 1.6.0 and the same PlotlyJS version. I installed the last Julia version a few days before, and it worked with 1.5.2. too.

Have you plotted with the same configuration before or this is the first trial?

@mananbordia
Copy link

mananbordia commented Apr 2, 2021

I have installed Julia 1.6.0 and reinstalled PlotlyJS but still face the same issue.
Screenshot 2021-04-03 at 3 33 47 AM

And Yes this is my first time.
I am using Jupyter Notebook on Safari (hope that is not the issue).

@diegozea
Copy link
Contributor

Same issue on Julia 1.6.2, with IJulia v1.23.2, WebIO v0.8.15, and PlotlyJS v0.18.7

Screenshot from 2021-09-13 16-32-57

Screenshot from 2021-09-13 16-33-34

The webio extension is installed:

shell> /home/diego/.local/bin/jupyter nbextension list
Known nbextensions:
  config dir: /home/diego/.jupyter/nbconfig
    notebook section
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
      webio-jupyter-notebook  enabled 
      - Validating: OK

@sglyon sglyon reopened this Sep 14, 2021
@twavv
Copy link
Contributor

twavv commented Sep 14, 2021

@diegozea Can you try updating to the latest WebIO and installing the new Jupyter extension? https://juliagizmos.github.io/WebIO.jl/latest/providers/ijulia/

@diegozea
Copy link
Contributor

I have updated it, and it works! Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.