ipython - In which conda environment is Jupyter executing?

ID : 10429

viewed : 33

Tags : ipythonanacondajupyterjupyter-notebookipython

Top 5 Answer for ipython - In which conda environment is Jupyter executing?

vote vote

93

As mentioned in the comments, conda support for jupyter notebooks is needed to switch kernels. Seems like this support is now available through conda itself (rather than relying on pip). http://docs.continuum.io/anaconda/user-guide/tasks/use-jupyter-notebook-extensions/

conda install nb_conda

which brings three other handy extensions in addition to Notebook Conda Kernels.

vote vote

87

Question 1: Find the current notebook's conda environment

Open the notebook in Jupyter Notebooks and look in the upper right corner of the screen.

It should say, for example, "Python [env_name]" if the language is Python and it's using an environment called env_name.

jupyter notebook with name of environment


Question 2: Start Jupyter Notebook from within a different conda environment

Activate a conda environment in your terminal using source activate <environment name> before you run jupyter notebook. This sets the default environment for Jupyter Notebooks. Otherwise, the [Root] environment is the default.

jupyter notebooks home screen, conda tab, create new environment

You can also create new environments from within Jupyter Notebook (home screen, Conda tab, and then click the plus sign).

And you can create a notebook in any environment you want. Select the "Files" tab on the home screen and click the "New" dropdown menu, and in that menu select a Python environment from the list.

jupyter notebooks home screen, files tab, create new notebook

vote vote

76

which environment is jupyter executing:

import sys print(sys.executable) 

create kernel for jupyter notebook

source activate myenv python -m ipykernel install --user --name myenv --display-name "Python (myenv)" source activate other-env python -m ipykernel install --user --name other-env --display-name "Python (other-env)" 

http://ipython.readthedocs.io/en/stable/install/kernel_install.html#kernel-install

vote vote

63

If the above ans doesn't work then try running conda install ipykernel in new env and then run jupyter notebook from any env, you will be able to see or switch between those kernels.

vote vote

57

You can also switch environments in Anaconda Navigator, install Jupiter and run it. Anaconda Navigator

Top 3 video Explaining ipython - In which conda environment is Jupyter executing?

Related QUESTION?