Conda environment not showing up in Jupyter Notebook?
I have created Anaconda environment.
I have installed Jupyter inside the environment.
But when I create new Jupyter notebook, I can’t see the jupyter kernel for my conda environment.
Ever faced this issue? Well, then you are reading the right article.
In our last article we have seen how to create anaconda environment using Navigator as well as command line.
If you haven’t read the post yet then check it here.
So, I am assuming that you are ready with conda environment and also installed jupyter inside the environment.
But when you open jupyter and try to create new notebook you can’t see an kernel with your active conda environment.
Let’s resolve this issue.
Open jupyter notebook
Open command prompt from the location where you want to create the notebook.
Activate the environment
conda activate env_demo1
Open jupyter notebook
This will open jupyter in your default browser.
But if you try to create new notebook:
To add this kernel we have to run this command:
python -m ipykernel install --user --name env_demo1 --display-name "Python (env_demo1)"
Always remember that whenever you are installing anything inside your conda environment after activating it, conda will automatically take care of using it’s own Python.exe
But if you are installing anything in your environment using any other command other than conda then always make sure you are using the Python.exe from your environment only.
Even if you check your python executable by #where python command and your environment’s python is 1st on the list, you have to explicitly use this Python.exe when using commands like pip
- You can either go to the environment directory in command prompt where your environment’s python executable is available. or
- You can specify path of your Python.exe before the above command
I am using the 2nd option. (make sure there is no space between your path to environment’s Python.exe as it will be considered as another argument in command line which is not and if there is a space in your path then enclose it inside double quotes.)
So my above command will become:
C:\ProgramData\Anaconda3\envs\env_demo1\python.exe -m ipykernel install --user --name env_demo1 --display-name "Python (env_demo1)"
Let’s check! (Refresh your browser window where jupyter is open)
Thanks for reading guys.
Follow and reach to us via Facebook, Instagram and Twitter.
Please mention any type of suggestion/query in the comments. Also you can suggest us on what topic you would like to read an article. We will try our best to post on the same.