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

206 views
Skip to first unread message

Shaik Zainul

unread,
Dec 20, 2020, 12:22:39 PM12/20/20
to jupyter-...@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

samuel....@gmail.com

unread,
Dec 21, 2020, 12:46:08 AM12/21/20
to Teaching with Jupyter Notebooks
2020-12-20 17:22:39 UTC, Zain:

>
> 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 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.

This is an answer to point 1.

One way would be to make a copy of your python3 kernel

$ cd /share/apps/platform/ai/py36/3_6_9/share/jupyter/kernels/
$ cp python3 python2

and to adapt the kernel.json by hand

$ vim python2/kernel.json

That is just a json file (a text file with special syntax)
which tells jupyter how to talk to Python and what
kernel name to display; adapt it so it talks to Python2
and displays Python 2 as the kernel name.

Hope this works for you.  Kind regards,  --Samuel
Reply all
Reply to author
Forward
0 new messages