Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Machine Learning pin python version on notebook

Looking for a way to use Python 3.10 on a compute resource associated to Azure ML Studio It appears 3.10 is available with ML Studio and we select 3.10 with SDK2 from the kernel selection dropdown but when running a "python --version" on the terminal, it says v 3.8.5. Is there a way to get Azure ML Studio to use a different version of Python? We've tried the environment option but had no luck. Looks like the kernel selection option does not match what the OS is running, perhaps it's designed to work this way?

like image 495
mac Avatar asked Feb 06 '26 00:02

mac


1 Answers

That is because of the selected conda environment. There will be multiple environments created when you create a compute instance.

To see, run the conda command below:

%%sh
conda info --env

This lists the environments present.

However, if you run this in a notebook, you cannot see which environment you are in.

So, execute these commands in the terminal.

Open the compute and select Terminal.

enter image description here

There, you will see the default is Python 3.8.

enter image description here

You can also see this with the commands below:

conda info --env

or

conda env list

or 

echo $CONDA_DEFAULT_ENV

Output:

enter image description here

Whenever you select the kernel, it doesn't switch the environment in the terminal; that only changes in the notebook Python code.

Whatever command you run in a subprocess or using %%sh, it takes the default Python environment.

import sys, platform
print(sys.version)
print(platform.python_version())

enter image description here

like image 62
Jaya Shankar G S Avatar answered Feb 07 '26 15:02

Jaya Shankar G S



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!