Jupyter (iPython) notebook says "cannot find a kernel matching Python [Root]"
Solution 1
The following assumes you've already created a python3
venv and you're using a windows system:
- Open the command line and
activate
thepython3
environment with:
activate <environment name>
- On the same command line of step 1, install
jupyter
forpython3
:
pip install jupyter
- Create a
bat
file on the folder containing thepython3
notebooks:
jupyter.bat:
c:\<anaconda path>\envs\<environment name>\Scripts\jupyter-notebook.exe
- Now just run jupyter.bat and it should open the default browser with all the
python3
notebooks on the current folder.
Solution 2
I have not had time to fully digest the answer in the post you reference: Using both Python 2.x and Python 3.x in IPython Notebook -- but if what you currently have isn't working properly then what I would suggest is:
Install Anaconda if you haven't already (it sounds like you probably have done this).
conda update conda
to update to the latest Conda (always a good idea)conda install anaconda=4.1.1
to make sure you have the latest Anaconda (well, as of this date)conda create -n ana41py27 anaconda python=2.7
to create a Python 2.7 based Conda environment that contains all the Anaconda packagesconda create -n ana41py35 anaconda python=3.5
to create a Python 3.5 based Conda environment that contains all the Anaconda packages
If you have any problems with those steps, report them here or on the Anaconda mailing list.
Once you have that in place you can start Jupyter notebook (any way you like, pretty much), and then you will be able to create new notebooks that are either Python 2.7 or Python 3.5 based by choosing the appropriate kernel from the "New" button:
or change between a Python 2.7 or Python 3.5 kernel from within a Notebook:
Admin
Updated on July 04, 2022Comments
-
Admin almost 2 years
I'm interested in using Jupyter notebooks with both Python 2 and Python 3 (one of my colleagues insists on still using Python 2 ;) ).
So I diligently followed the steps listed in this excellent answer: Using both Python 2.x and Python 3.x in IPython Notebook.
I installed multiple kernels and now Jupyter notebooks has the option to use both Python 2 and Python 3!
However, I managed to somehow delete the Python[Root] kernel. Now, every time I open a notebook, it comes up with an error message and makes me choose between Python 2 and Python 3 kernel.
This is not the end of the world, but I'd like it to default to my Python[Root] kernel every time I open a new notebook. I use Anaconda by the way.
Thanks for the assistance!