Question 1: How can I know which conda environment is my jupyter notebook running on? Launch your Anaconda Prompt and run the command conda env list to list all the available conda environments.
JupyterLab is a modern interactive development environment (IDE) that allows you to work with code, data, and the Jupyter notebook format. Starting with v1. 5.0 , the ArcGIS API for Python can be used in JupyterLab for a truly powerful development experience.
Open the directory where you want to create your project. open cmd/powershell and navigate to the same directory and run the following commands to create a virtual environment. Now as we have our virtual environment let's activate it.
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.
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.
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.
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.
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
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.
You can also switch environments in Anaconda Navigator, install Jupiter and run it.
to show which conda env a notebook is using just type in a cell:
!conda info
if you have grep, a more direct way:
!conda info | grep 'active env'
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