How to start Slicer Jupyter kernel?

What operating system do you use? What Python distribution do you use?

What do you mean by “running the Jupyter kernel”? What do you do exactly (what application you started or what command entered)?

I downloaded stable Slicer then installed SlicerJupyter(it didn’t appear in modules then manually copy libs).

What did you copy? Where?

Linux. Python Environment manages by Miniconda.

Start jupyter and then run notebook (kernel is Slicer 4.10).

Because when I installed extension SlicerJupyter it doesn’t appear in modules menu. Additionaly I checked in python interpreter slicer.modules. Then I manually copy files from ~/.config/NA-MIC/Extension-27501/SlicerJupyter/lib and share to Slicer-4.10.0-linux-amd64/lib and share. Then JupyterKernel show in Slicer.

I checked pyzmq with no change.
I don’t know why Slicer doesn’t load correctly module, because I see in Settings/Modules path to ~/.config/NA-MIC/Extensions-27501/SlicerJupyter/lib/Slicer-4.10/qt-loadable-modules/ and exist in Extension Manager.

@jcfr Could you try installing SlicerJupyter on your Linux computer and check if the modules is loaded?

@ihnorton created a docker image that works well on binder, but that’s for Slicer-4.9, so it does not directly prove that it should work with Slicer-4.10, too.

Maby I should check slicer 4.9 but I don’t know what revision, because some crash when I try open Extension Manager.

Working… but. Firstly I removed Slicer-4.10.0 and install and follow installation from this repo:
https://github.com/ihnorton/dockerfiles/tree/master/slicer2binder and then I saw some interesting line here https://github.com/ihnorton/dockerfiles/blob/master/slicer2binder/install.sh:

# TODO HACK
export LD_LIBRARY_PATH=$HOME/.config/NA-MIC/Extensions-27480/SlicerJupyter/lib64/

And everything works but one CPU core has 100% usage.

Then I try same guidelines with Slicer-4.10 but Jupyter can’t start Slicer with this export:

export LD_LIBRARY_PATH=$HOME/.config/NA-MIC/Extensions-27501/SlicerJupyter/lib64/

but working with this:

export LD_LIBRARY_PATH=$HOME/.config/NA-MIC/Extensions-27480/SlicerJupyter/lib64/

It is curious, because(static/dynamic linking?):
curious

Slicer 4.10(or 4.9) working with SlicerJupyter when is set:

export LD_LIBRARY_PATH=$HOME/.config/NA-MIC/Extensions-27480/SlicerJupyter/lib64/

Thanks a lot @darekdev , these are very helpful! @jcfr when you have some time please have a look at this. I think for you it should be very easy to fix this.

Reported 100% CPU use should not cause any problem or affect processing speed, it just polls the jupyter connection very frequently when the application is idle. I’ve implemented a fix for Windows but wanted to get confirmation from users that it happens on other platforms, too, before enabling it everywhere. I’ll now enable it for all platforms.

I built a SlicerJupyter extension bundle (w/ Slicer nightly image) separate from the nightly package, due to the missing libuuid on the build machine at the time. That is fixed now, but I haven’t tested SlicerJupyter on a real linux machine. I think the export is needed because the fixup step doesn’t work correctly for libxeus or one of the other secondary requirements. I will update the docker image soon and have a look if Jc doesn’t fix it first.

This is now fixed in

3 Likes

In reference to the use of CPU.
I test this module and there is no more 100% CPU usage.

1 Like

Dear andras,
I installed a new version of slicer 4.11.0 and I tried to install the jupyter kernel but it gives me error.

Kernelspec install error output: “Traceback (most recent call last):\r\n File “C:\Users\22374464\AppData\Local\Continuum\anaconda3\Scripts\jupyter-kernelspec-script.py”, line 6, in \r\n from jupyter_client.kernelspecapp import KernelSpecApp\r\n File “C:\Users\22374464\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\init.py”, line 4, in \r\n from .connect import *\r\n File “C:\Users\22374464\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\connect.py”, line 23, in \r\n import zmq\r\n File “C:\Users\22374464\AppData\Local\Continuum\anaconda3\lib\site-packages\zmq\init.py”, line 47, in \r\n from zmq import backend\r\n File “C:\Users\22374464\AppData\Local\Continuum\anaconda3\lib\site-packages\zmq\backend\init.py”, line 40, in \r\n reraise(*exc_info)\r\n File “C:\Users\22374464\AppData\Local\Continuum\anaconda3\lib\site-packages\zmq\utils\sixcerpt.py”, line 34, in reraise\r\n raise value\r\n File “C:\Users\22374464\AppData\Local\Continuum\anaconda3\lib\site-packages\zmq\backend\init.py”, line 27, in \r\n _ns = select_backend(first)\r\n File “C:\Users\22374464\AppData\Local\Continuum\anaconda3\lib\site-packages\zmq\backend\select.py”, line 27, in select_backend\r\n mod = import(name, fromlist=public_api)\r\n File “C:\Users\22374464\AppData\Local\Continuum\anaconda3\lib\site-packages\zmq\backend\cython\init.py”, line 6, in \r\n from . import (constants, error, message, context,\r\nImportError: DLL load failed: The specified module could not be found.\r\n”
bool __cdecl qSlicerJupyterKernelModule::installSlicerKernel(class QString) failed: process “C:/Users/22374464/AppData/Local/Continuum/anaconda3/Scripts/jupyter-kernelspec” returned with exit code 1

Dear Andras,
The error is fixed. I am using anaconda.
Did what was written on

pip uninstall pyzmq
and then
pip install pyzmq

thanks a lot.

can i use the web version of jupyter?

It is indeed possible to open Slicer notebooks on the cloud using binder. See https://github.com/Slicer/SlicerJupyter#option-1-run-using-binder