How to change the pytorch version in Google colab

Viewed 3451

I need to change the pytorch version in google colab,so i install anaconda

%%bash
MINICONDA_INSTALLER_SCRIPT=Miniconda3-4.5.4-Linux-x86_64.sh
MINICONDA_PREFIX=/usr/local
wget https://repo.continuum.io/miniconda/$MINICONDA_INSTALLER_SCRIPT
chmod +x $MINICONDA_INSTALLER_SCRIPT
./$MINICONDA_INSTALLER_SCRIPT -b -f -p $MINICONDA_PREFIX

import sys
_ = (sys.path
        .append("/usr/local/lib/python3.6/site-packages"))

and then

!conda install  pytorch==1.0.0 torchvision==0.2.1 cuda100 -c pytorch --yes

but when i

import torch
torch.__version__

it's 1.9+cuda120

what's more, when i trying to

pip uninstall torch

colab told me that do you want to uninstall pytorch-1.0.0

how does it happen?

1 Answers

First, you have to run

!pip uninstall torch

Then, when you are prompted with Proceed (y/n)?, click on the background of where the output is being printed, press y and then click Enter. This will uninstall torch, it will take more or less 5 minutes.

Then, you have to

!pip install torch==1.0.0

And finally

import torch
torch.__version__
# '1.0.0'
Related