# Add multiple python kernels like 3.6.x and 3.7.x to jupyterhub

**URL:** <https://discourse.jupyter.org/t/add-multiple-python-kernels-like-3-6-x-and-3-7-x-to-jupyterhub/5458>\
**Category:** JupyterHub\
**Created:** [August 2, 2020, 5:44am UTC](https://discourse.jupyter.org/t/add-multiple-python-kernels-like-3-6-x-and-3-7-x-to-jupyterhub/5458 "2020-08-02T05:44:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zainul1114](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/zainul1114/32/2193_2.png) [@zainul1114](https://discourse.jupyter.org/u/zainul1114)\
**Post date:** [August 2, 2020, 5:44am UTC](https://discourse.jupyter.org/t/add-multiple-python-kernels-like-3-6-x-and-3-7-x-to-jupyterhub/5458/1 "2020-08-02T05:44:40Z")

</div>

my default python version is 3.6.8 which is installed from python sourcefile, and i am able to run jupyter notebook. Python path: /share/apps/platform/ai/py36/3\_6\_8/bin/python3

Now i am trying to add 3.7.6  
Python path: /share/apps/platform/ai/py37/3\_7\_6/bin/python3

```auto
# jupyter-kernelspec list
Available kernels:
  python3 /share/apps/platform/ai/py36/3_6_9/share/jupyter/kernels/python3

```

Please guide me to add multiple python kernels.

Regards,  
Zain

---

<div class="post-metadata">

**Author:** ![Joseph\_Wang](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/joseph_wang/32/1962_2.png) [@Joseph\_Wang](https://discourse.jupyter.org/u/Joseph_Wang)\
**Post date:** [August 9, 2020, 10:30pm UTC](https://discourse.jupyter.org/t/add-multiple-python-kernels-like-3-6-x-and-3-7-x-to-jupyterhub/5458/2 "2020-08-09T22:30:29Z")

</div>

For linux

Go into /usr/share/jupyter/kernels

There is a directory for each kernel, and you should be able to copy an existing configuration and generate a new one.

---

<div class="post-metadata">

**Author:** ![zainul1114](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/zainul1114/32/2193_2.png) [@zainul1114](https://discourse.jupyter.org/u/zainul1114)\
**Post date:** [August 15, 2020, 5:23pm UTC](https://discourse.jupyter.org/t/add-multiple-python-kernels-like-3-6-x-and-3-7-x-to-jupyterhub/5458/3 "2020-08-15T17:23:45Z")

</div>

Dear Joseph,

I have trying add Python 3.7.6 kernel to Jupyterhub ( Jupyterhub which is already running with Python 3.6.9)  
i have run below command

```auto
# jupyter-kernelspec install /share/apps/platform/ai/py37/3_7_6/share/jupyter/kernels/python3/ --name=python37 --display-name=python37

```

My kernels list and my kernel.json is

```auto
[root@master ai]# jupyter-kernelspec list
Available kernels:
  ir /root/.local/share/jupyter/kernels/ir
  java /share/apps/platform/ai/py36/3_6_9/share/jupyter/kernels/java
  python3 /share/apps/platform/ai/py36/3_6_9/share/jupyter/kernels/python3
  python37 /usr/local/share/jupyter/kernels/python37
[root@master ai]# cat /usr/local/share/jupyter/kernels/python37/
kernel.json logo-32x32.png logo-64x64.png
[root@master ai]# cat /usr/local/share/jupyter/kernels/python37/kernel.json
{
 "argv": [
  "/share/apps/platform/ai/py37/3_7_6/bin/python3",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 37",
 "language": "python"
}
[root@master ai]#

```

Now, i have opened jupyter browser and check the kernels and seen the below notebooks

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/jupyter/original/2X/5/5861129ff6f0dceecae350c913a1b15a79172ccf.png)

However, when i run the Python3 notebook,check the version,it showing my python version as python 3.6.9

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/jupyter/original/2X/a/ada88e5ef3f53e588572425b6b9b001ccd23821d.png)

Then i run the Pyhton37 notebook, check the version,

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/jupyter/original/2X/c/ce54678a4ea710001277d74b0efe1a919a23d6b3.png)

it is getting error as **No Kernel!!**

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/jupyter/original/2X/e/e921a0017829cbe1b6e10ba588cc1ad7250a0b2c.png)

Finally i check the jupyterhub logs

```auto
Aug 15 22:42:12 master jupyterhub: [I 2020-08-15 22:42:12.401 SingleUserNotebookApp log:174] 204 PUT /user/zain/lab/api/workspaces/lab?1597511533151 (zain@192.1
68.43.8) 6.65ms
Aug 15 22:42:13 master jupyterhub: [I 2020-08-15 22:42:13.303 SingleUserNotebookApp restarter:110] KernelRestarter: restarting kernel (4/5), new random ports
Aug 15 22:42:13 master jupyterhub: /share/apps/platform/ai/py37/3_7_6/bin/python3: error while loading shared libraries: libpython3.7m.so.1.0: cannot open share
d object file: No such file or directory
Aug 15 22:42:13 master jupyterhub: [I 2020-08-15 22:42:13.662 SingleUserNotebookApp log:174] 200 GET /user/zain/metrics?1597511534379 (zain@192.168.43.8) 18.49m
s
Aug 15 22:42:13 master jupyterhub: [I 2020-08-15 22:42:13.681 SingleUserNotebookApp log:174] 200 GET /user/zain/metrics?1597511534381 (zain@192.168.43.8) 16.01m
s
Aug 15 22:42:16 master jupyterhub: [I 2020-08-15 22:42:16.088 SingleUserNotebookApp log:174] 200 GET /user/zain/api/terminals?1597511536836 (zain@192.168.43.8)
3.65ms
Aug 15 22:42:16 master jupyterhub: [W 2020-08-15 22:42:16.332 SingleUserNotebookApp restarter:100] KernelRestarter: restart failed
Aug 15 22:42:16 master jupyterhub: [W 2020-08-15 22:42:16.338 SingleUserNotebookApp kernelmanager:135] Kernel b1f9abb5-27ef-4fb7-90e4-f9921680c69f died, removin
g from map.
Aug 15 22:42:18 master jupyterhub: [I 2020-08-15 22:42:18.737 SingleUserNotebookApp log:174] 200 GET /user/zain/metrics?1597511539452 (zain@192.168.43.8) 36.09m
s

```

And my Python installation directory structure as below and python 3.6.9 is my default python version(added python 3.6.9 to ~/.bashrc)

```auto
[root@master ai]# tree -L 3
.
├── py27
│ └── 2_7_16
│ ├── bin
│ ├── etc
│ ├── include
│ ├── lib
│ └── share
├── py36
│ └── 3_6_9
│ ├── bin
│ ├── etc
│ ├── include
│ ├── lib
│ └── share
└── py37
    └── 3_7_6
        ├── bin
        ├── include
        ├── lib
        └── share

20 directories, 0 files
[root@master ai]#

```

Please help me out to resolve this.

Regards,  
Zain

---

<div class="post-metadata">

**Author:** ![Joseph\_Wang](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/joseph_wang/32/1962_2.png) [@Joseph\_Wang](https://discourse.jupyter.org/u/Joseph_Wang)\
**Post date:** [August 17, 2020, 8:17am UTC](https://discourse.jupyter.org/t/add-multiple-python-kernels-like-3-6-x-and-3-7-x-to-jupyterhub/5458/4 "2020-08-17T08:17:43Z")

</div>

What happens if you try to run the commands from the command line?

I think that the python executable isn’t picking up the libraries.

---

<div class="post-metadata">

**Author:** ![zainul1114](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/zainul1114/32/2193_2.png) [@zainul1114](https://discourse.jupyter.org/u/zainul1114)\
**Post date:** [August 17, 2020, 4:18pm UTC](https://discourse.jupyter.org/t/add-multiple-python-kernels-like-3-6-x-and-3-7-x-to-jupyterhub/5458/5 "2020-08-17T16:18:19Z")

</div>

Hi,  
From command line i am not able to view python3.7 command itself.  
(Once i export Python3.7 PATH and LD\_LIBRARY\_PATH it showed, then from command line i can able to get the python3.7 --version)

**I think that the python executable isn’t picking up the libraries.** —\> yes , i am getting this error messge ` jupyterhub: /share/apps/platform/ai/py37/3_7_6/bin/python3.7: error while loading shared libraries: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory`

Regads,  
Zain

---

<div class="post-metadata">

**Author:** ![Joseph\_Wang](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/joseph_wang/32/1962_2.png) [@Joseph\_Wang](https://discourse.jupyter.org/u/Joseph_Wang)\
**Post date:** [August 18, 2020, 2:26am UTC](https://discourse.jupyter.org/t/add-multiple-python-kernels-like-3-6-x-and-3-7-x-to-jupyterhub/5458/6 "2020-08-18T02:26:23Z")

</div>

Yes that looks like the problem. What you can try is to write a shell script that sets the environment variables and runs the kernel, and put that into kernel json

The script would look something like

#!/bin/bash  
LD\_LIBRARY\_PATH=(path to libraries)  
exec (python executable) $@

fiddle with the script until you can run it from the command line, Once you can run it from the command line it should work from the web browser.
