6

I am new in PyTorch and I have faced one issue, namely I cannot get my torch_sparse module properly installed. In general, I wanted to use module torch_geometric - this I have installed. However, when during the execution of the program I keep receiving the error ModuleNotFoundError: No module named ‘torch_sparse’ .

I try to intall it, but when I use the command pip install torch-sparse in anaconda, I get an error:

UserWarning: CUDA initialization:Found no NVIDIA driver on your system.

My system does not have a CUDA. So how could I install torch_sparse module without it?

Thank you in advance!

Kind regards

Rostyslav

Rostyslav
  • 85
  • 1
  • 1
  • 5

2 Answers2

12

As outlined in in pytorch_geometric installation instructions you have to install dependencies first and torch_geometric after that.

For PyTorch 1.7.0 and CPU:

pip install --no-index torch-scatter -f https://pytorch-geometric.com/whl/torch-1.7.0+cpu.html
pip install --no-index torch-sparse -f https://pytorch-geometric.com/whl/torch-1.7.0+cpu.html
pip install --no-index torch-cluster -f https://pytorch-geometric.com/whl/torch-1.7.0+cpu.html
pip install --no-index torch-spline-conv -f https://pytorch-geometric.com/whl/torch-1.7.0+cpu.html
pip install torch-geometric

Please notice torch-1.7.0+cpu at the very end of each page

Szymon Maszke
  • 22,747
  • 4
  • 43
  • 83
  • Hi! Thank you for the reply! Well, I have uninstalled my ``` torch-geometric``` and now I am trying to install ```torch-scatter``` using ```pip install --no-index torch-scatter -f https://pytorch-geometric.com/whl/torch-1.7.1.html``` However I receive an error ERROR: Could not find a version that satisfies the requirement torch-scatter (from versions: none) ERROR: No matching distribution found for torch-scatter even though my PyTorch version is 1.7.1 and I have no cuda. Do you know what is the reason? – Rostyslav Jan 23 '21 at 21:36
  • @Rostyslav if you are using anaconda, please install `pip` inside `conda` first using `conda install pip`. After that follow with those commands. – Szymon Maszke Jan 23 '21 at 21:37
  • Sorry, I am using ```pip install --no-index torch-scatter -f https://pytorch-geometric.com/whl/torch-1.7.1+cpu.html``` as you suggested. But still the same error ERROR: Could not find a version that satisfies the requirement torch-scatter (from versions: none) ERROR: No matching distribution found for torch-scatter – Rostyslav Jan 23 '21 at 21:45
  • 1
    @Rostyslav make sure that you use Python `3.8`, not `3.9`. – Szymon Maszke Jan 23 '21 at 21:47
  • I use Python 3.8.5 – Rostyslav Jan 23 '21 at 21:51
  • @Rostyslav https://pytorch-geometric.com/whl/ here are available versions. Go with `torch-1.7.0` as in my answer, not in `torch-1.7.1` – Szymon Maszke Jan 23 '21 at 21:55
  • 2
    Works! Thank you – Rostyslav Jan 23 '21 at 22:09
0

I have found the use of conda instead of pip very useful. Running the following three commands turned out to be smooth and without errors:

  1. conda install -c pyg pytorch-sparse
  2. conda install -c pyg pytorch-scatter
  3. conda install -c pyg pyg

As far as I understood from the torch-geometric docs,we should be fine with these commands on CUDA/CPU.

chakrr
  • 329
  • 3
  • 9