I wanted to change path of the kernel in Jupyter to set it to the one I'm using in the machine.
Here is the original kernels that were install in jupyter:
jupyter kernelspec list
Available kernels:
python3 /home/n/.local/share/jupyter/kernels/python3
python2 /usr/local/share/jupyter/kernels/python2
Then I checked the path of python3 in my machine like this:
which python3
/usr/bin/python3
$ ipython kernelspec list
I deleted the kernel of python3 like this:
jupyter kernelspec uninstall python3
which was successfully performed, then I tried to install python3 using the path I found earlier like this:
jupyter kernelspec install /usr/bin/python3
which gave me this error:
File "/usr/local/bin/jupyter-kernelspec", line 11, in sys.exit(KernelSpecApp.launch_instance())
File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 658, in launch_instance app.start()
File "/usr/local/lib/python2.7/dist-packages/jupyter_client/kernelspecapp.py", line 273, in start return self.subapp.start()
File "/usr/local/lib/python2.7/dist-packages/jupyter_client/kernelspecapp.py", line 143, in start replace=self.replace,
File "/usr/local/lib/python2.7/dist-packages/jupyter_client/kernelspec.py", line 299, in install_kernel_spec shutil.copytree(source_dir, destination)
File "/usr/lib/python2.7/shutil.py", line 171, in copytreenames = os.listdir(src) OSError: [Errno 20] Not a directory: '/usr/bin/python3'
Then I looked for the correct path like this:
python3 -c "import sys; print ('\n'.join(sys.path))"
/usr/lib/python3.4
/usr/lib/python3.4/plat-x86_64-linux-gnu
/usr/lib/python3.4/lib-dynload
/usr/local/lib/python3.4/dist-packages
/usr/local/lib/python3.4/dist-packages/setuptools-28.8.0-py3.4.egg
/usr/lib/python3/dist-packages
I tried to install it gain like this:
sudo jupyter kernelspec install /usr/lib/python3.4
[InstallKernelSpec] Installed kernelspec python3.4 in /usr/local/share/jupyter/kernels/python3.4
Now, when I start jupyter there is no Python 3 at all as a kernel, I'm not sure now what to do?
You probably haven't installed ipykernel
on your python 3 install. To install a python kernel the proper steps are:
pip3 install ipykernel
python3 -m ipykernel install --user
See here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With