Search code examples
pythoninstallationpytorchgpugoogle-colaboratory

Can't install PyTorch 1.7.0


I need to install these four packages (to run this code):

!pip install allennlp==1.3
!pip install transformers==4.0.0
!pip install torch==1.7.0
!pip install networkx

These commands work in a Jupyter Notebook, but I need to use a GPU for this project. When I run it in Google Colab, Kaggle Kernel, and Deepnote, I get this error:

ERROR: Could not find a version that satisfies the requirement torch==1.7.0 (from versions: 1.11.0, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2) ERROR: No matching distribution found for torch==1.7.0

Running these (suggested by other posts) still produces an error:

!pip install torch==1.7.0 -f https://download.pytorch.org/whl/torch_stable.html 
!pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html

I also tried the proxy fix from here, but none of the 30 proxies I tried worked.

How can I install PyTorch 1.7.0 on a platform that provides free GPU access?


Solution

  • Consider updating your Python version on Colab to an older one (3.8 for example),

    I tried Python 3.8 and it worked fine .

    See :

    here is the method that I followed to update the versio.