Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update Python on Vertex AI notebooks?

I am working in notebooks provided in the Workbench section of Vertex AI. I need an updated version of Python, but I only have access to Python 3.7 in these notebooks. I have successfully followed these steps and if I run python3.8 --version in terminal, I get Python 3.8.2, which is good, but python --version still returns Python 3.7.12. If, following this answer and restarting notebook's kernel, I run

from platform import python_version
print(python_version())

in a notebook, and I get 3.7.12.

How do I get a notebook in Vertex AI supporting an up-to-date Python version?

like image 635
zabop Avatar asked Dec 12 '25 13:12

zabop


2 Answers

For me, @ewertonvsilva's answer wasn't working. I had to install the ipython kernel at user level then deactivate the kernel before refreshing the page to make the environment appearing on Jupyter Lab, All commands combined :

# create a new conda env:
$ conda create -n python38 python=3.8

# Activate your new Python 3.8 environment:
$ conda activate python38

#install ipykernel when logged in the new env:
(python38)$ conda install ipykernel

# install the ipython kernel at user level    
(python38)$ ipython kernel install --user --name=python38

# Deactivate the new environment
(python38)$ conda deactivate

Then refresh the page.

Sources :

How to add conda environment to jupyter lab

Installing the IPython kernel - IPython Documentation

like image 98
Gilles Charlier Avatar answered Dec 14 '25 04:12

Gilles Charlier


#create a new conda env:
$ conda create -n python38 python=3.8

#Activate your new Python 3.8 environment:
$ conda activate python38

#install ipykernel when logged in the new env:
(python38)$ conda install ipykernel

Refresh the page and the new python38 env will be avaiable: enter image description here enter image description here

like image 23
ewertonvsilva Avatar answered Dec 14 '25 02:12

ewertonvsilva



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!