How to add multiple python kernel(2.7.x,3.6.x,3.7.x) to jupyterhub

64 views
Skip to first unread message

Shaik Zainul

unread,
Jun 30, 2020, 1:39:12 PM6/30/20
to jup...@googlegroups.com
Hi,
i am new to jupyterhub and i am trying to setup 
1. add multiple python kernel(2.7.x,3.6.x,3.7.x) to jupyterhub 
2. setup user specific kernel - means i have 3 kernels PY3, Pyspark and R. how can i assign this 3 PY3, Pyspark and R kernels to User1, User2 and User3 respectively on Jupyterhub. 

my default python version is 3.6.8 which is installed from python sourcefile, and i am able to run jupyterhub with python3.
Python path: /share/apps/platform/ai/py36/3_6_8/bin/python3

But now i am trying to add Python 2.7.16
 
Python path: /share/apps/platform/ai/py27/2_7_16/bin/python

# jupyter-kernelspec list
Available kernels:
ir /root/.local/share/jupyter/kernels/ir
pyspark /share/apps/platform/ai/py36/3_6_9/share/jupyter/kernels/pyspark
python3 /share/apps/platform/ai/py36/3_6_9/share/jupyter/kernels/python3


Please guide me to add multiple python kernels and also how to setup user specific kernels in Jupyterhub.

--
Regards
Zain

Shaik Zainul

unread,
Aug 15, 2020, 12:39:47 PM8/15/20
to Project Jupyter
Hi all,
Please any one help me,
 how to add 3.7.x kernel to jupyterhub( which is running with 3.6.8 kernel)

--Thanks 

Samuel Lelièvre

unread,
Aug 17, 2020, 6:33:09 AM8/17/20
to Project Jupyter
2020-08-15 16:39:47 UTC, Shaik Zainul:
how to add 3.7.x kernel to jupyterhub (which is running with 3.6.8 kernel)

On Tuesday, June 30, 2020 at 11:09:12 PM UTC+5:30, Shaik Zainul wrote:
Hi,
i am new to jupyterhub and i am trying to setup 
1. add multiple python kernel(2.7.x,3.6.x,3.7.x) to jupyterhub 
2. setup user specific kernel - means i have 3 kernels PY3, Pyspark and R. how can i assign this 3 PY3, Pyspark and R kernels to User1, User2 and User3 respectively on Jupyterhub. 

my default python version is 3.6.8 which is installed from python sourcefile, and i am able to run jupyterhub with python3.
Python path: /share/apps/platform/ai/py36/3_6_8/bin/python3

But now i am trying to add Python 2.7.16
 
Python path: /share/apps/platform/ai/py27/2_7_16/bin/python

# jupyter-kernelspec list
Available kernels:
ir /root/.local/share/jupyter/kernels/ir
pyspark /share/apps/platform/ai/py36/3_6_9/share/jupyter/kernels/pyspark
python3 /share/apps/platform/ai/py36/3_6_9/share/jupyter/kernels/python3


Please guide me to add multiple python kernels and also how to setup user specific kernels in Jupyterhub.

One good source of information on these topics is the ipykernel documentation:


The main trick is you cannot have several kernels with the same display name.

Open the file

/share/apps/platform/ai/py36/3_6_9/share/jupyter/kernels/python3/kernel.json

and change the kernel's "display_name" from "Python 3" to "Python 3.6".

Then run something like the following:

$ python37 -m ipykernel install --name 'Python 3.7'

replacing `python37` by any suitable way for you to call Python 3.7.

Shaik Zainul

unread,
Aug 17, 2020, 12:30:45 PM8/17/20
to Project Jupyter
Hi Samuel,
I have try to add Python3.7 kernel, as followed

```
[root@master ~]# python3.7 -m ipykernel install --name 'Python37'
Installed kernelspec Python37 in /usr/local/share/jupyter/kernels/python37
[root@master ~]# 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 ~]#
```

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

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

it is getting error as No Kernel!!
image

Finally i check the jupyterhub logs
```
Aug 17 21:37:28 master jupyterhub: [I 2020-08-17 21:37:28.767 SingleUserNotebookApp restarter:110] KernelRestarter: restarting kernel (2/5), new random ports
Aug 17 21:37:28 master jupyterhub: /share/apps/platform/ai/py37/3_7_6/bin/python3.7: error while loading shared libraries: libpython3.7m.so.1.0: cannot open sha
red object file: No such file or directory
Aug 17 21:37:29 master jupyterhub: [I 2020-08-17 21:37:29.557 SingleUserNotebookApp log:174] 200 GET /user/zain/api/terminals?1597680450116 (za...@192.168.43.8)
8.74ms
Aug 17 21:37:31 master jupyterhub: [I 2020-08-17 21:37:31.791 SingleUserNotebookApp restarter:110] KernelRestarter: restarting kernel (3/5), new random ports
Aug 17 21:37:31 master jupyterhub: /share/apps/platform/ai/py37/3_7_6/bin/python3.7: error while loading shared libraries: libpython3.7m.so.1.0: cannot open sha
red object file: No such file or directory
Aug 17 21:37:32 master jupyterhub: [I 2020-08-17 21:37:32.608 SingleUserNotebookApp log:174] 200 GET /user/zain/api/contents/?content=1&1597680453144 (zain@192.
168.43.8) 30.67ms
Aug 17 21:37:32 master jupyterhub: [I 2020-08-17 21:37:32.813 SingleUserNotebookApp log:174] 200 GET /user/zain/api/sessions?1597680453366 (za...@192.168.43.8) 7
.15ms
Aug 17 21:37:32 master jupyterhub: [I 2020-08-17 21:37:32.866 SingleUserNotebookApp log:174] 200 GET /user/zain/api/kernels?1597680453435 (za...@192.168.43.8) 3.
78ms
Aug 17 21:37:33 master jupyterhub: [I 2020-08-17 21:37:33.212 SingleUserNotebookApp log:174] 200 GET /user/zain/metrics?1597680453751 (za...@192.168.43.8) 28.86m
s
Aug 17 21:37:33 master jupyterhub: [I 2020-08-17 21:37:33.343 SingleUserNotebookApp log:174] 200 GET /user/zain/metrics?1597680453875 (za...@192.168.43.8) 31.66m
s
Aug 17 21:37:34 master jupyterhub: [I 2020-08-17 21:37:34.815 SingleUserNotebookApp restarter:110] KernelRestarter: restarting kernel (4/5), new random ports
Aug 17 21:37:34 master jupyterhub: /share/apps/platform/ai/py37/3_7_6/bin/python3.7: error while loading shared libraries: libpython3.7m.so.1.0: cannot open sha
red object file: No such file or directory
Aug 17 21:37:37 master jupyterhub: [W 2020-08-17 21:37:37.836 SingleUserNotebookApp restarter:100] KernelRestarter: restart failed
Aug 17 21:37:37 master jupyterhub: [W 2020-08-17 21:37:37.837 SingleUserNotebookApp kernelmanager:135] Kernel 448a56bf-42a3-4718-a126-26f5cf5c0d37 died, removin
g from map.
Aug 17 21:37:38 master jupyterhub: [I 2020-08-17 21:37:38.284 SingleUserNotebookApp log:174] 200 GET /user/zain/metrics?1597680458811 (za...@192.168.43.8) 31.79m
s
```
Actually, my Python installation directory structure as below and python 3.6.9 is my default python version(added python 3.6.9 to ~/.bashrc)
```
[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 guide me to resolve this issue.

Regards,
Zain
Reply all
Reply to author
Forward
0 new messages