# How to start Slicer Jupyter kernel?

**URL:** <https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855>\
**Category:** Support\
**Tags:** jupyter\
**Created:** [August 21, 2018, 11:01am UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855 "2018-08-21T11:01:54Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [August 21, 2018, 11:01am UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/1 "2018-08-21T11:01:54Z")

</div>

Dear Andras,  
I installed the JupyterKernel but I receive error output as below:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/9/99a95f3796b612d3313dd29be61281c6b44e2beb.png)

Then I launched jupyter through anaconda. it looks like as below:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/d/8da38329b0fdd0a6707dd02cffe6fc82826cf5ca.png)

I have 4.9 nighly version of slicer which I dont see here.

Please guide.  
Thank you

Regards,  
Saima Safdar

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 21, 2018, 11:31am UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/2 "2018-08-21T11:31:56Z")

</div>

I’ve improved module documentation - see [https://github.com/Slicer/SlicerJupyter/blob/master/README.md](https://github.com/Slicer/SlicerJupyter/blob/master/README.md)

If the instructions are still not clear enough then let us know.

---

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [August 21, 2018, 1:53pm UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/3 "2018-08-21T13:53:03Z")

</div>

Dear Andras,  
I am getting these errors.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/3/6331e17401492a26cc2be5b62e348f2f4d12782d.png)

Please help in fixing.

Regards,  
Saima Safdar

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 21, 2018, 5:29pm UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/4 "2018-08-21T17:29:18Z")

</div>

I only see a small part of the error message. Could you please copy-paste the content of the error box? Could you please also copy the Slicer application log (menu: Help / Report a bug)?

---

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [August 22, 2018, 3:24am UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/5 "2018-08-22T03:24:20Z")

</div>

Yes Please see the errors below:

```
Traceback (most recent call last):
  File "D:\anaconda\lib\site-packages\tornado\web.py", line 1543, in _execute
    result = yield result
  File "D:\anaconda\lib\site-packages\tornado\gen.py", line 1099, in run
    value = future.result()
  File "D:\anaconda\lib\site-packages\tornado\concurrent.py", line 260, in result
    raise_exc_info(self._exc_info)
  File "D:\anaconda\lib\site-packages\tornado\gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "D:\anaconda\lib\site-packages\notebook\services\sessions\handlers.py", line 73, in post
    type=mtype))
  File "D:\anaconda\lib\site-packages\tornado\gen.py", line 1099, in run
    value = future.result()
  File "D:\anaconda\lib\site-packages\tornado\concurrent.py", line 260, in result
    raise_exc_info(self._exc_info)
  File "D:\anaconda\lib\site-packages\tornado\gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "D:\anaconda\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 79, in create_session
    kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
  File "D:\anaconda\lib\site-packages\tornado\gen.py", line 1099, in run
    value = future.result()
  File "D:\anaconda\lib\site-packages\tornado\concurrent.py", line 260, in result
    raise_exc_info(self._exc_info)
  File "D:\anaconda\lib\site-packages\tornado\gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "D:\anaconda\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 92, in start_kernel_for_session
    self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
  File "D:\anaconda\lib\site-packages\tornado\gen.py", line 1099, in run
    value = future.result()
  File "D:\anaconda\lib\site-packages\tornado\concurrent.py", line 260, in result
    raise_exc_info(self._exc_info)
  File "D:\anaconda\lib\site-packages\tornado\gen.py", line 315, in wrapper
    yielded = next(result)
  File "D:\anaconda\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 148, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "D:\anaconda\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "D:\anaconda\lib\site-packages\jupyter_client\manager.py", line 259, in start_kernel
    **kw)
  File "D:\anaconda\lib\site-packages\jupyter_client\manager.py", line 204, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "D:\anaconda\lib\site-packages\jupyter_client\launcher.py", line 128, in launch_kernel
    proc = Popen(cmd, **kwargs)
  File "D:\anaconda\lib\subprocess.py", line 394, in __init__
    errread, errwrite)
  File "D:\anaconda\lib\subprocess.py", line 644, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

```

The setup for JupyterKernel

- Slicer Kernel folder: C:/Users/22374464/AppData/Roaming/NA-MIC/Extensions-27353/SlicerJupyter/share/Slicer-4.9/qt-loadable-modules/JupyterKernel/Slicer-4.9
- Python Scripts folder: D:/anaconda/Scripts

Log from slicer warning message:

```
Kernelspec install error output:
[InstallKernelSpec] Removing existing kernelspec in C:\\Users\\22374464\\AppData\\Roaming\\jupyter\\kernels\\slicer-4.9
[InstallKernelSpec] Installed kernelspec slicer-4.9 in C:\\Users\\22374464\\AppData\\Roaming\\jupyter\\kernels\\slicer-4.9

```

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/d/3ddc1701ce5bc67abaaeb2dbf82b4eae6ea32469.png)

---

<div class="post-metadata">

**Author:** ![darekdev](https://avatars.discourse-cdn.com/v4/letter/d/e5b9ba/32.png) [@darekdev](https://discourse.slicer.org/u/darekdev)\
**Post date:** [August 22, 2018, 9:20am UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/6 "2018-08-22T09:20:22Z")

</div>

Is this build version? It is high probability that I have got similar error. I have a built version of Slicer and then need to build SlicerJupiter. Then I copied the files:

> cp -r /home/broncho/SlicerExtensions/SlicerJupyter-build/inner-build/lib/Slicer-4.9 /home/software/medical/slicer4.9/Slicer-SuperBuild-Release/Slicer-build/share/  
> cp -r /home/broncho/SlicerExtensions/SlicerJupyter-build/lib/Slicer-4.9 /home/software/medical/slicer4.9/Slicer-SuperBuild-Release/Slicer-build/lib/

Didn’t working without copied libraries from inner-build.

Then in Slicer I have selected Jupyter directiory(virtual environment).  
This information may be useful.

---

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [August 22, 2018, 12:51pm UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/7 "2018-08-22T12:51:00Z")

</div>

no its not build version

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 22, 2018, 3:20pm UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/8 "2018-08-22T15:20:56Z")

</div>

@saima Can you copy here the contents of the file `C:\Users\22374464\AppData\Roaming\jupyter\kernels\slicer-4.9\kernel.json`?

---

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [August 23, 2018, 3:07am UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/9 "2018-08-23T03:07:00Z")

</div>

> [@lassoan](#):
>
> e the contents of the file

Please see the contents of file kernel.json

```
{
    "display_name": "Slicer 4.9",
    "language" : "python",
    "argv": [
        "C:/Program Files/Slicer 4.9.0-2018-08-17/bin/../Slicer.exe",
        "--no-splash",
        "--python-code",
        "connection_file=r'{connection_file}'; print('Jupyter connection file: ['+connection_file+']'); slicer.modules.jupyterkernel.startKernel(connection_file);slicer.util.mainWindow().showMinimized()"
    ]
}

```

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 23, 2018, 3:21am UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/10 "2018-08-23T03:21:15Z")

</div>

Does Slicer start if you type this on the command-line?

```
C:/Program Files/Slicer 4.9.0-2018-08-17/bin/../Slicer.exe

```

Could you please also try with the latest nightly build (that you’ve downloaded just now)? Install SlicerJupyter extension, install the kernel, restart Jupyter, create a new notebook with Slicer-4.9 kernel.

---

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [August 23, 2018, 5:39am UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/11 "2018-08-23T05:39:25Z")

</div>

Dear Andras,  
The file slicer.exe is at location: D:\Slicer4.9\Slicer 4.9.0-2018-08-17  
Its not at C:/Program Files/Slicer 4.9.0-2018-08-17/bin/…/Slicer.exe.

Should I change the script manually? or should I reinstall in C drive

Yes I tried with the latest nightly build.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 23, 2018, 11:04am UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/12 "2018-08-23T11:04:38Z")

</div>

Yes, changing the path in kernel.json file should fix the issue.

Did you move Slicer manually from `C:\Program Files\...` to `D:\Slicer4.9\...`?

---

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [August 23, 2018, 11:20am UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/13 "2018-08-23T11:20:25Z")

</div>

no I didnt I installed on D drive.  
Yes its connected now.

Why the path was not correct?

Thank you so much Andras

Dear Andras can I have code completion in this.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 23, 2018, 5:19pm UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/14 "2018-08-23T17:19:30Z")

</div>

I’ve checked the implementation and kernel.json was only updated once, when a specific Slicer version was installed the first time. You’ve installed first on the C drive and then when you uninstalled and reinstalled it on D drive, the program path in the kernel file still pointed to the deleted installation.

I’ve pushed a fix - now kernel.json is updated whenever the kernel is installed. So, the error should not occur anymore for SlicerJupyter versions that you download tomorrow or later.

---

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [August 30, 2018, 11:42am UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/15 "2018-08-30T11:42:20Z")

</div>

Yes I followed the steps you mentioned. Kernel is running but I dont get the auto complete. I changed the path manually. Should I install again the slicer and the extensions.

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [August 30, 2018, 2:20pm UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/16 "2018-08-30T14:20:08Z")

</div>

> [@Saima](#):
>
> Should I install again the slicer and the extensions.

Yes, you will need to update to get new fixes/features.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 30, 2018, 4:28pm UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/17 "2018-08-30T16:28:18Z")

</div>

To make sure that your kernel is using the latest Slicer version, please enter the following into a cell in your Jupyter notebook, run it, and let us know what version do you get:

```
print slicer.app.applicationVersion
```

---

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [August 31, 2018, 7:40am UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/18 "2018-08-31T07:40:30Z")

</div>

Its 4.9.0-2018-08-17

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 31, 2018, 12:00pm UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/19 "2018-08-31T12:00:19Z")

</div>

That version did not contain auto-complete yet. You need to install latest nightly version and reinstall the extension and kernel as described above.

---

<div class="post-metadata">

**Author:** ![darekdev](https://avatars.discourse-cdn.com/v4/letter/d/e5b9ba/32.png) [@darekdev](https://discourse.slicer.org/u/darekdev)\
**Post date:** [November 26, 2018, 9:15pm UTC](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855/20 "2018-11-26T21:15:19Z")

</div>

Hi everyone.

I am trying to prepare the environment for my friend but when running the jupyter kernel Slicer exit abnormally. I followed instruction from github.  
I downloaded stable Slicer then installed SlicerJupyter(it didn’t appear in modules then manually copy libs). What am I doing wrong?

Greetings.

[Next page](https://discourse.slicer.org/t/how-to-start-slicer-jupyter-kernel/3855.md?page=2)
