jupyter_rfb icon indicating copy to clipboard operation
jupyter_rfb copied to clipboard

Basic Vispy example does not work - JavaScript loading errors

Open jeertmans opened this issue 2 years ago • 8 comments

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.

jeertmans avatar Dec 27 '23 18:12 jeertmans

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?

djhoese avatar Dec 28 '23 15:12 djhoese

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?

jeertmans avatar Dec 29 '23 09:12 jeertmans

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.

kushalkolar avatar Dec 29 '23 09:12 kushalkolar

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 :-)

jeertmans avatar Dec 29 '23 10:12 jeertmans

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:

kushalkolar avatar Dec 29 '23 11:12 kushalkolar

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 😄

almarklein avatar Jan 02 '24 22:01 almarklein

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

kushalkolar avatar Jan 02 '24 22:01 kushalkolar

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.

jeertmans avatar Jan 03 '24 14:01 jeertmans

@almarklein I think this can be closed?

kushalkolar avatar May 14 '24 09:05 kushalkolar

Yeah, this seems to be an environment problem.

almarklein avatar May 14 '24 09:05 almarklein