I want to upgrade to python 3.10 in my google cloud shell, but I failed to do so. I found two methods online, which were unsuccessful so far.
- Using the deadsnakes repo: I tried the following commands:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
But I get an Error The repository 'http://ppa.launchpad.net/deadsnakes/ppa/ubuntu kinetic Release' does not have a Release file.
- Install from the source: I followed the tutorial in this link.
I am able to install python 3.10. But when my Google Cloud Shell restarts, I am unable to run python3.10. It states-bash: python3.10: command not found
.
2
Answers
This worked out for me. The default python version remained 3.10.7 even after the shell restarted.
credit to @ali-khorso and @yungchin. Link to the post
Google Cloud Shell environment is ephemeral and reset after each session, as an alternative solution you can configure your Google Cloud Shell by creating a Docker image that functions as a custom Cloud Shell environment with your specified additional packages and custom configurations. Refer on this documentation to Customize Cloud Shell container images and Environment customization.
Additionally Google Cloud Shell is running on Debian 11, you can follow this guide on Installing Python 3.10 On Debian 11.