PyTorch torch_sparse installation without CUDA

Question:

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

Asked By: Rostyslav

||

Answers:

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

Answered By: Szymon Maszke

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.

Answered By: chakrr
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.