pytorchgoogle-colaboratoryreinforcement-learningtorchvision

Can't install torchrl into Google Colab after torch 2.2.1


I am using RL environments in Google Colab with the torchrl library. The following code used to work:

!pip3 install torchrl

Now, I get the following error from running that line at the beginning of the notebook:

Installing collected packages: triton, nvidia-nvtx-cu12, nvidia-nvjitlink-cu12, nvidia-nccl-cu12, nvidia-curand-cu12, nvidia-cufft-cu12, nvidia-cuda-runtime-cu12, nvidia-cuda-nvrtc-cu12, nvidia-cuda-cupti-cu12, nvidia-cublas-cu12, nvidia-cusparse-cu12, nvidia-cudnn-cu12, nvidia-cusolver-cu12, torch, tensordict, torchrl
  Attempting uninstall: triton
    Found existing installation: triton 2.1.0
    Uninstalling triton-2.1.0:
      Successfully uninstalled triton-2.1.0
  Attempting uninstall: torch
    Found existing installation: torch 2.1.0+cu121
    Uninstalling torch-2.1.0+cu121:
      Successfully uninstalled torch-2.1.0+cu121

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
torchaudio 2.1.0+cu121 requires torch==2.1.0, but you have torch 2.2.1 which is incompatible.
torchdata 0.7.0 requires torch==2.1.0, but you have torch 2.2.1 which is incompatible.
torchtext 0.16.0 requires torch==2.1.0, but you have torch 2.2.1 which is incompatible.
torchvision 0.16.0+cu121 requires torch==2.1.0, but you have torch 2.2.1 which is incompatible.

The installation also runs much more slowly. I think that the issue has something to do with the fact that torch 2.2.1 was released recently, but I am not sure how to resolve it (running !pip3 install torch==2.1.0 first does not work as it is uninstalled for some reason). Any insight is appreciated. Thanks so much!


Solution

  • That's odd, pip3 install torchrl works on my end. The issues seems to come from audio/text/vision which have been installed previously Does

    !pip3 install torchrl torchvision torchaudio torchtext torchdata -U
    

    Solves your issue? You could also consider removing a couple of these if you're not using them