Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Downgrade Python 3.10 to 3.9 in google colab

It looks like there is a compatibility issue with PyTorch and Python 3.10 when I want to use google Colab. I need to use !pip install torch==1.8 torchvision==0.9 but this problem don't let me.
I should do Downgrading.

I need to get code to downgarde Python version.

like image 583
mahnoosh torabi Avatar asked Oct 19 '25 06:10

mahnoosh torabi


1 Answers

Below is a method to downgrade Python. But you should note that every time you want to use the conda environment to install or work with it, you must first use this script ! source activate env_name; or easily use %%bash first of cells to activate it, then write the command you want exactly after this script.

Step 1:

! python --version

Step 2:

!pip install -q condacolab

import condacolab

condacolab.install()

Step 3:

!conda --version

Step 4:

you should choose a python version from the output of this code and replace to PYTHON_VERSION in next step: !conda search python

Step 5:

! conda create -n env_name python=PYTHON_VERSION # PYTHON_VERSION can be 3.9 or any other releas

Step 6:

you should create a requirements.txt file and place name of all packages which you need to install on it.

Step 7:

! source activate env_name; python --version; pip -V; pip install -r requirements.txt

like image 111
Omid Ostovari Avatar answered Oct 21 '25 18:10

Omid Ostovari



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!