ihaskell-notebook icon indicating copy to clipboard operation
ihaskell-notebook copied to clipboard

ihaskell-vega not working in JupyterLab 2

Open jamesdbrock opened this issue 5 years ago • 4 comments

https://github.com/DougBurke/hvega/issues/141

jamesdbrock avatar Apr 27 '20 03:04 jamesdbrock

I don't know if this is the same cause you were experiencing when you created this issue, but I get an error when I execute vlshow for example from VegaLiteGallery.ipynb:

vlShow barFromColumns
Javascript Error: requirejs is not defined

Similar errors in other example notebooks.

chapmanbe avatar Dec 31 '21 05:12 chapmanbe

Hi @chapmanbe , thanks for the note. Yeah, I see the same thing.

It looks like @DougBurke released v0.4.0.0 of ihaskell-hvega in October. I'll try an omni-upgrade of the ihaskell-notebook and let's see if that's an improvement.

jamesdbrock avatar Jan 01 '22 14:01 jamesdbrock

Update: this problem still appears with versions

ihaskell-0.10.2.2
ghc-8.10.7
hvega-0.12.0.2
ihaskell-hvega-0.5.0.2
JupyterLab 3.2.5

I'll publish a new ihaskell-notebook image with these version updates anyway.

jamesdbrock avatar Jan 01 '22 15:01 jamesdbrock

Random comments that may or may not be helpful

  • the behavior depends on whether you are using jupyter notebook or lab
  • it depends what version of jupyter lab you are using (although I forget now what problems this can cause)

If you are using jupyter notebook and recent versions of the whole stack then you should just be able to display a VegaLite instance without any problem. This relies on javascript code external to the notebook stack (https://vega.github.io/vega-lite/usage/embed.html) and so there's always the chance that there's a problem with this.

If you are using jupyter lab then you have to use vlShow to convert the type into something that has the correct mimetype for the jupyter display code to display, and this uses the in-built support (in the lab stack) for Vega-Lite. This requires using a version of jupyter lab which matches ihaskell/ihaskell-hvega (e.g. that ihaskell sends the appropriate mime-type).

If you use vlShow when you are running jupyter notebook (or forget to include it when you are using jupyter lab) then things don't work.

I ended up getting getting frustrated trying to get this to all work well together in all combinations as it felt like whenever I tried to address it there was some problem in the stack somewhere. I got to https://github.com/DougBurke/hvega/issues/141#issuecomment-619971325 and then ran out of energy/time/interest.

DougBurke avatar Jan 01 '22 16:01 DougBurke