I was working on a PyTorch Geometric project using Google Colab for CUDA support. Since it's library isn't present by default, I run:
!pip install --upgrade torch-scatter
!pip install --upgrade torch-sparse
!pip install --upgrade torch-cluster
!pip install --upgrade torch-spline-conv
!pip install torch-geometric
Recently, while importing torch_geometric, owing to version upgrades, there's a CUDA version mismatch saying:
RuntimeError: Detected that PyTorch and torch_sparse were compiled with different CUDA versions. PyTorch has CUDA version 10.1 and torch_sparse has CUDA version 10.0. Please reinstall the torch_sparse that matches your PyTorch install.
To solve this, I tried using conda for specific CUDA version as:
!conda install pytorch==1.4.0 cudatoolkit=10.0 -c pytorch
Yet, on running print(torch.version.cuda)
, I get 10.1 as the output and not 10.0 as I wanted.
This is a recent error since it wasn't throwing up this issue in past week. Any best practice to solve this issue?
From their website
Try this
!pip install torch-geometric \
torch-sparse==latest+cu101 \
torch-scatter==latest+cu101 \
torch-cluster==latest+cu101 \
-f https://pytorch-geometric.com/whl/torch-1.4.0.html
You can find example colab notebooks on the pytorch geometric official website https://pytorch-geometric.readthedocs.io/en/latest/notes/colabs.html
Here is what I used from the same website. It is working on the date of posting.
!pip install -q torch-scatter -f https://data.pyg.org/whl/torch-1.10.0+cu113.html
!pip install -q torch-sparse -f https://data.pyg.org/whl/torch-1.10.0+cu113.html
!pip install -q git+https://github.com/pyg-team/pytorch_geometric.git
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With