pyg-team / pytorch_geometric

Graph Neural Network Library for PyTorch
https://pyg.org
MIT License
21.31k stars 3.65k forks source link

Error report in Installation of torch-scatter in Win10 cpu #2357

Open wanyu42 opened 3 years ago

wanyu42 commented 3 years ago

📚 Installation

Environment

Checklist

Additional context

rusty1s commented 3 years ago

Can you try to install via

pip install --no-index torch-scatter -f https://pytorch-geometric.com/whl/torch-1.7.0+cpu.html
wanyu42 commented 3 years ago

It seems that there is no version

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

ERROR: Could not find a version that satisfies the requirement torch-scatter ERROR: No matching distribution found for torch-scatter

rusty1s commented 3 years ago

Please use a lowercase t:

https://pytorch-geometric.com/whl/torch-1.7.0+cpu.html
wanyu42 commented 3 years ago

Sorry, it is just a typo in the last comment. With lowercase t it still gets the errors. Would it be possible that the problem comes from python 3.9?

wanyu42 commented 3 years ago

It seems that the problem is due to python3.9. I successfully downloaded torch_geometric with python3.8. However, when I tested with import torch_geometric, I encountered another error with _scatter_cpu.pyd ddl ( OSError: [WinError 127] The specified procedure could not be found.) :

import torch_geometric Traceback (most recent call last): File "", line 1, in File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_geometric__init.py", line 2, in import torch_geometric.nn File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_geometric\nn__init.py", line 2, in from .data_parallel import DataParallel File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_geometric\nn\data_parallel.py", line 5, in from torch_geometric.data import Batch File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_geometric\data__init__.py", line 1, in from .data import Data File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_geometric\data\data.py", line 8, in from torch_sparse import coalesce, SparseTensor File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_sparse\init__.py", line 36, in from .storage import SparseStorage # noqa File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_sparse\storage.py", line 5, in from torch_scatter import segment_csr, scatter_add File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_scatter\init.py", line 13, in torch.ops.load_library(importlib.machinery.PathFinder().find_spec( File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_ops.py", line 104, in load_library ctypes.CDLL(path) File "C:\Users\wanyu\anaconda3\envs\graph\lib\ctypes\init.py", line 381, in init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 127] 找不到指定的程序。

I wonder whether this error is caused by cpu version instead of cuda.

rusty1s commented 3 years ago

Yes, we currently do not yet provide wheels for Python 3.9, sorry! Do you have a PyTorch+CUDA installation? Then you will need to install the torch-scatter CUDA package as well. You should also verify that you do not have any previous torch-scatter installations by repeatedly running:

pip uninstall torch-scatter
IceCereal commented 3 years ago

To anyone in the future reading this and getting a: fatal error C1083: Cannot open compiler generated file: '': Invalid argument similar to this and the one referenced in issue #1958, there's a chance that this is happening: VS 2015 Cannot open compiler generated file: '': Invalid argument. The SO answer says, "Seems that I was bumping into the path/filename length limitation of Visual Studio. The error message was not particularly descriptive, but reducing the hierarchy solved the problem"; this means that whatever file path was being passed while trying to install is over 260 characters long, the default Windows sets. The log says that it happens at this part:

ERROR: Command errored out with exit status 1: 'd:\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\username\\AppData\\Local\\Temp\\pip-install-fsjcjgdf\\torch-scatter_1703e1f783e247f484059bc080a5aaa4\\setup.py'"'"'; __file__='"'"'C:\\Users\\username\\AppData\\Local\\Temp\\pip-install-fsjcjgdf\\torch-scatter_1703e1f783e247f484059bc080a5aaa4\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\username\AppData\Local\Temp\pip-record-yl965_fd\install-record.txt' --single-version-externally-managed --compile --install-headers 'd:\python39\Include\torch-scatter'

You can try to change the Windows registry value to allow long paths (guide here) but that didn't work for me.

Solution that worked for me:

If you tried to install it using pip following the instructions as provided on the PyTorch geometric installation page under the Install via Binaries section and this error happened, try to manually download the wheels from the https://pytorch-geometric.com/whl/ part that corresponds to your torch version & cuda version and do a pip install on the downloaded files (which is essentially the Installation from Source section below) .

Also, like @rusty1s mentioned above, python3.9 isn't supported so make sure you're using python3.8 (at least for now until 3.9 support comes in). I realized that after downloading the wheels.

Tried doing too many things for a good two hours trying to figure out why I was repeatedly getting the same error when I just realized that this was just so much easier.

HuangDDU commented 2 years ago

It seems that the problem is due to python3.9. I successfully downloaded torch_geometric with python3.8. However, when I tested with import torch_geometric, I encountered another error with _scatter_cpu.pyd ddl ( OSError: [WinError 127] The specified procedure could not be found.) :

import torch_geometric Traceback (most recent call last): File "", line 1, in File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_geometricinit.py", line 2, in import torch_geometric.nn File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_geometric\nninit.py", line 2, in from .data_parallel import DataParallel File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_geometric\nn\data_parallel.py", line 5, in from torch_geometric.data import Batch File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_geometric\datainit.py", line 1, in from .data import Data File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_geometric\data\data.py", line 8, in from torch_sparse import coalesce, SparseTensor File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_sparseinit.py", line 36, in from .storage import SparseStorage # noqa File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_sparse\storage.py", line 5, in from torch_scatter import segment_csr, scatter_add File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_scatterinit.py", line 13, in torch.ops.load_library(importlib.machinery.PathFinder().find_spec( File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_ops.py", line 104, in load_library ctypes.CDLL(path) File "C:\Users\wanyu\anaconda3\envs\graph\lib\ctypesinit.py", line 381, in init self._handle = _dlopen(self._name, mode) OSError: [WinError 127] 找不到指定的程序。

I wonder whether this error is caused by cpu version instead of cuda.

@ wanyu42 I also met the question,

File "C:\Users\wanyu\anaconda3\envs\graph\lib\site-packages\torch_ops.py", line 104, in load_library ctypes.CDLL(path) File "C:\Users\wanyu\anaconda3\envs\graph\lib\ctypesinit.py", line 381, in init self._handle = _dlopen(self._name, mode) OSError: [WinError 127] 找不到指定的程序。 how do you deal with that?