xeus-python
xeus-python copied to clipboard
Is it possible to specify the xeus-python kernel to jupyterlab installed in another virtual environment?
Nice to see this package frees people from hard debugging on Jupyter. I am facing a small problem at the start of the journey.
The xeus-python kernel works perfectly when it was installed in the same conda environment with the jupyterlab. But I didn't find a way to use an existing xeus-python kernel on the jupyterlab installed in base env.
(base) hcl@DESKTOP-BFS5NUK:~/anaconda3/share/jupyter$ conda env list
# conda environments:
#
base /home/hcl/anaconda3
EMG2LegPy38 /home/hcl/anaconda3/envs/EMG2LegPy38
xeus-python /home/hcl/anaconda3/envs/xeus-python
I tried the jupyter kernelspec install command but it doesn't work either.
(base) hcl@DESKTOP-BFS5NUK:~/anaconda3/share/jupyter$ jupyter kernelspec install /home/hcl/anaconda3/envs/xeus-python --sys-prefix
[InstallKernelSpec] Removing existing kernelspec in /home/hcl/anaconda3/share/jupyter/kernels/xeus-python
[InstallKernelSpec] Installed kernelspec xeus-python in /home/hcl/anaconda3/share/jupyter/kernels/xeus-python

(base) hcl@DESKTOP-BFS5NUK:~/anaconda3/share/jupyter$ jupyter kernelspec list
Available kernels:
python3 /home/hcl/anaconda3/share/jupyter/kernels/python3
emg2legpy38 /usr/local/share/jupyter/kernels/emg2legpy38
Then I used ipykernel and it succeeds.
(base) hcl@DESKTOP-BFS5NUK:~$ /home/hcl/anaconda3/bin/python -m ipykernel install --name xeus-python_ipykernel --user
Installed kernelspec xeus-python_ipykernel in /home/hcl/.local/share/jupyter/kernels/xeus-python_ipykernel
(base) hcl@DESKTOP-BFS5NUK:~/anaconda3/share/jupyter$ jupyter kernelspec list
Available kernels:
xeus-python_ipykernel /home/hcl/.local/share/jupyter/kernels/xeus-python_ipykernel
python3 /home/hcl/anaconda3/share/jupyter/kernels/python3
emg2legpy38 /usr/local/share/jupyter/kernels/emg2legpy38
However, jupyter naturally recognize the ipykernel instead of the xeus-python kernel hence debugging is no more supported.
So I would like to know how to install an existing xeus-python kernel to a jupyterlab in another environment.
The kernelspec install command is currently not supported by xeus-python. You need to install the kernel in the environment where Jupyter Lab is installed (and yes, this means potentially installing the same package in different environments).
It might be possible by adding the proper path to jupyter --paths?
I got this working by manually creating a kernelspec in /Users/me/Library/Jupyter/kernels. I copied the folder with the kernelspec from the environment where xeus is installed to one of the places where jupyter will look for kernels. Not sure if this breaks anything, but basic functionality is there.