I have an instance with various environment and some notebooks are compatible with different environment for e.g. notebook1 is for MXNet and notebook2 is for Tensorflow.
How do I jump to new environment when I move from notebook1 to notebook2? I tried doing that but this doesn't quite work with Jupyter notebook? Any suggestion?
So I need to do it from conda environment but looks like jupyter notebook UI doesn't respect (calls right activation function) to set the path.
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 Notebook can easily be installed using conda. Our plan is to only install it in the base environment, and then just switch between sub-environments to avoid setting up Jupyter Lab in each environment.
If you want to switch to another environment you could simply type: conda activate myenv within the base environment. Now when you deactivate myenv it will go back to base environment. When you are within an environment, the packages within that environment can be accessible.
Installing the nb_conda_kernels
package as suggested by user @jcb91 worked for me. I did have to install it both in my root (base) environment as well as the virtual environment with which I wanted to use it. To do this, run the following in the Anaconda prompt (in your base environment):
conda install nb_conda_kernels
Then, activate your virtual environment (in the code below named 'myenv') and install the nb_conda_kernels
package there as well. You can do this by running in the Anaconda prompt:
conda activate myenv
conda install nb_conda_kernels
You now should be able to switch to your different environment using:
Kernel -> Change Kernel
You could use the nb_conda_kernels package, which provides a separate jupyter kernel for each conda environment, along with the appropriate code to handle their setup. This makes switching conda environment as simple as switching jupyter kernel (e.g. from the kernel menu), which I find very convenient. You can get it from the conda-forge channel, using
conda install -c conda-forge nb_conda_kernels
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