JuliaGizmos / WebIO.jl

A bridge between Julia and the Web.
https://juliagizmos.github.io/WebIO.jl/latest/
Other
228 stars 64 forks source link

show(::IO, ::MIME"text/html", ::Node) is broken in Jupyterlab #448

Closed jlumpe closed 3 years ago

jlumpe commented 3 years ago

The bug

display("text/html", node::Node) in Jupyterlab using IJulia results in a red box displaying the following error message:

WebIO not detected.

Please read the troubleshooting guide for more information on how to resolve this issue.

https://juliagizmos.github.io/WebIO.jl/latest/troubleshooting/not-detected/

display(node) and display("application/vnd.webio.node+json", node) work as intended.

git blame shows the relevant lines were last updated over a year ago (99b5d78c), so I'm wondering if this method became obsolete and was never removed.

Context

pkg> status WebIO
Status `~/.julia/environments/v1.5/Project.toml`
  [0f1e0344] WebIO v0.8.15
julia> versioninfo()
Julia Version 1.5.1
Commit 697e782ab8 (2020-08-25 20:08 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
> jupyter labextension list
JupyterLab v2.2.6
Known labextensions:
   app dir: /home/jared/opt/anaconda3/share/jupyter/lab
        @axlair/jupyterlab_vim v0.12.4  enabled  OK
        @webio/jupyter-lab-provider v0.8.15  enabled  OK
twavv commented 3 years ago

This is working as expected. JupyterLab doesn't expose its internals via global variables the way that the classic notebook does, so it's not possible to render WebIO as vanilla HTML.

jlumpe commented 3 years ago

The underlying error may be expected in this condition, but I don't think that's reflected in the error message. It makes it seem like the problem is that WebIO has not been installed correctly. "WebIO Not Detected" is the same message shown when importing WebIO without having the jupyterlab extension installed and it even links to the same troubleshooting page, despite this being a totally separate issue (I spent a lot of time troubleshooting thinking my installation was messed up due to this error). The message should say something about this being expected in Jupyterlab and to use application/vnd.webio.node+json instead of text/html.

twavv commented 3 years ago

You're welcome to open a PR to add this and/or add a section in the docs. I think that message links to a troubleshooting docs page, so it could be added there.

jlumpe commented 3 years ago

Sure, I can do that. I'm not familiar enough with the Jupyterlab front end stuff to really know what's being checked in those if statements, though. It looks like the 2nd condition is the only one that actually displays the data. The first one just logs the message "Jupyter WebIO extension detected, not mounting." As far as I can tell that one should probably be displayed in the HTML as well. I'm just not really sure what the messages should be since I can't tell what conditions are triggering them.