vispy / jupyter_rfb

Remote Frame Buffer for Jupyter
https://jupyter-rfb.readthedocs.io
MIT License
55 stars 10 forks source link

Basic Vispy example does not work - JavaScript loading errors #86

Closed jeertmans closed 1 month ago

jeertmans commented 6 months ago

Hello,

So I wanted to try rendering Vispy scenes inside Jupyter notebook, but I always get errors, with jupyter notebook and with jupyter lab: image

On Jupyter Notebook, the output cell is just plain blank, saying that there is an error with loadjs.

I just added jupypter_rfb to my dependencies... But am I missing something?

Should I somehow activate the extension?

I am using vispy==0.14.1, jupyter-rfb==0.4.2.

djhoese commented 6 months ago

I won't pretend to be up to date on this libraries development and compatibility with various versions of jupyterlab/notebook, but judging by your error messages it seems like your jupyter installation is a little...weird.

I see error messages about "en_US" not being installed and other jupyterlab packages. It also mentions jupyterlite and the xeus python kernel. Are you using jupyterlite? If so, can you try the full installation?

jeertmans commented 6 months ago

Well I have a main jupyter installation on which I just install per-project kernels. Maybe the installation is broken, or jupyterlab==4.0.3 is not supported. I installed a specific jupyterlab package for my project, specifying jupyterlab>=3,<4, like in your project.toml and it worked :-)

I think this would be good if you could pinpoint exact versions for which it is expected to work, and maybe a minimal install setup for reproduction?

kushalkolar commented 6 months ago

I think I've seen this before, you will need to launch jupyterlab from the environment that has jupyter_rfb in it. If I understand correctly, you launch jupyterlab from one env and then launch a kernel using Python in another env - this won't work for jupyter_rfb or any ipywidget related libraries as far as I know.

jeertmans commented 6 months ago

Well at least doing that solved my issue @kushalkolar :-) But the fact that you can have multiple jupyter installations that share multiple kernels can rapidly become hard to debug, so precising requirements on jupyter's version might be a good idea :-)

kushalkolar commented 6 months ago

I think the safest way to do it is, if you are using jupyter extensions then use the jupyterlab from the environment with the extensions. I don't know if there are ways to load extensions from other environments. My guess is that it probably gets messy if that's even possible. :laughing:

almarklein commented 6 months ago

Is this a problem specific to jupyter_rfb or would other tools using ipywidgets have similar issues? I don't have enough understanding of Jupyter to judge whether we can/should take action from the pov of jupyter_rfb 😄

kushalkolar commented 6 months ago

I spoke to a colleague here who has a similar setup, he uses nb_conda_kernels, is this what you're also using @jeertmans ?

I found this, it basically seems like you need to use jupyterlab from the same environment that has anything ipywidget-related because of how things are loaded: https://github.com/Anaconda-Platform/nb_conda_kernels/issues/201#issuecomment-760151093

jeertmans commented 6 months ago

Nope I don't use conda, but I have a mix of Poetry and now PDM virtualenvs, but I usually didn't mind installing jupyterlab on each virtualenv, just creating a kernel was (I thought) sufficient.

kushalkolar commented 1 month ago

@almarklein I think this can be closed?

almarklein commented 1 month ago

Yeah, this seems to be an environment problem.