I want to use a specific Python environment with specific libraries (Keras, TensorFlow) on an Azure Linux data science virtual machine (DSVM) to move some of my local work to the cloud.
I created the environment in the terminal using Keras v2.1.6. Also, I can see the environment in the Jupyter environment. However, when I switch my kernel to my new environment and run:
import keras
keras.__version__
# output: 2.1.2.
This should be 2.1.6.
Any help would be appreciated!
I resolved this issue. Here are the proper steps to use a custom environment or use a specific version of a library in a DSVM:
1. Create a new environment
From the DSVM, click 'New->Terminal'. Run the following command:
Note: You can substitute any languages or add other libraries. Instructions are in the Anaconda docs - Creating Environments.
2. Activate Env, install necessary library.
From the terminal:
The IPython Kernel is necessary to allow Jupyter to execute code in your new environment. Without this step, you will see your environment listed in the Jupyter UI but it won't connect and use your environment.
Expose the env to Jupyter
Run the following command to expose your new environment (
myenv
) to Jupyter and use the display name, Python (myenv):That's it!
Verifying your environment
In Jupyter refresh your browser, click 'New -> Python (myenv)'. You can verify that you're using the correct version of your libraries by simply: