0

I am using google colab which is connected with google cloud in a linux server.

When I am using google colab with google cloud by runing the following code

import sys
print(sys.version)

the output is '2.7.16 (default, Oct 10 2019, 22:02:15) [GCC 8.3.0]'

However, when I am connected with google cloud, the output is '3.7.11 (default, Jul 3 2021, 18:01:19) [GCC 7.5.0]'

So I want to upgrate it into python 3.7 and I don't know how.

I run the following code, but I still have the same problem

apt update
sudo apt install python3-pip
alias pip='pip3'

I checked also these sites https://cloud.google.com/python/docs/setup#linux_2, How do I install Python 3.7 in google cloud shell but didn't solve my problem.

Actually, I can see that there is python 3.7 in the server, but it uses the python 2.7, how can I change it to 3.7?

I would be grateful if you could help me!

  • You probably don't want to try and update the version - just look for a "Runtime - Change Runtime Type" option in the Colab UI? – AKX Jul 30 '21 at 17:52
  • @AKX, I did this. The default option is 'None'. I choose either 'GPU' or 'TPU', but I still have the same problem. –  Jul 30 '21 at 17:57
  • @AKX I would be grateful if you could recommend me something else to try. –  Jul 31 '21 at 18:49
  • What do you mean "connecting to google cloud? Do you mean that you use the IP of a VM you control? Or is it one of the managed services that GCP offers? Please clarify the backend used (or how do you connect to it) in order to understand the context better. – Jofre Aug 05 '21 at 13:23

1 Answers1

1

So actually the answer of my question comes from this post How to completely uninstall python 2.7.13 on Ubuntu 16.04.

Everyone who have a similar problem the first thing that he/she should do is to unistall python 2.7.