I'm using MS Azure ML and have found that when I start a Notebook (from the Azure ML Studio) it is executing in a a different environment than if I create a Python script and run it from the studio. I want to be able to create a specific environment and have the Notebook use that. The environment that the Notebook seems to run does not contain the packages I need and I want to preserve different environments.
First open a terminal, using the same compute target as you want to use with your Notebook afterwards, and to use and existing environment you can do:
conda activate existing_env
conda install ipykernel
python -m ipykernel install --user --name existing_env --display-name "Python 3.8 - Existing Environment"
However, to create a new environment and use it in you AzureML Notebook, you have to do the following commands:
conda create --name new_env python=3.8
conda activate new_env
conda install pip
conda install ipykernel
python -m ipykernel install --user --name new_env --display-name "Python 3.8 - New Environment"
And then last, but not least, you have to edit the Jupyter Kernel display names:
IMPORTANT Please ensure you are comfortable running all these steps:
jupyter kernelspec list
cd <folder-that-matches-the-kernel-of-your-environment>
sudo nano kernel.json
Then edit the name to match what you want and save the file.