Already refer to three posts at https://github.com/rusty1s/pytorch_geometric/issues/633,
https://github.com/rusty1s/pytorch_geometric/issues/599, and https://github.com/rusty1s/pytorch_geometric/issues/157, but none of the solutions work.
I Install Microsoft Visual Studio 2017 with Visual C++ Build Tools core features, Visual C++ 2017 Redistributable Update, VC++ 2017 version 15.9 v14.16 latest v141 tools, Windows 10 SDK (10.0.17763.0), Visual C++ tools for CMake, C++/CLI support, VC++ 2015.3 v14.00 (v140) toolset for desktop, LLVM Compiler Toolchain, Testing tools core features - Build Tools. I also install Visual Studio Build Tools 2017 and Windows Software Development Kit - Windows 10.0.26624.
Also, I also add paths based on readme
However, it seems still having compile issues.
How did you try to install PyTorch Geometric and its extensions (pip, source):
(1) pip install --verbose --no-cache-dir torch-scatter
(2) python setup.py build --compiler=mingw32 and python setup.py install
Any other relevant information:
nvcc.Failed to build torch-scatter
Installing collected packages: torch-scatter
Running setup.py install for torch-scatter ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\yliau\AppData\Local\Temp\pip-install-mmj7cpph\torch-scatter\setup.py'"'"'; __file__='"'"'C:\Users\yliau\AppData\Local\Temp\pip-install-mmj7cpph\torch-scatter\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\yliau\AppData\Local\Temp\pip-record-4yly6glz\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\yliau\AppData\Local\Temp\pip-install-mmj7cpph\torch-scatter\
Complete output (1436 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\test
copying test\test_backward.py -> build\lib.win-amd64-3.7\test
copying test\test_forward.py -> build\lib.win-amd64-3.7\test
copying test\test_max_min.py -> build\lib.win-amd64-3.7\test
copying test\test_multi_gpu.py -> build\lib.win-amd64-3.7\test
copying test\test_std.py -> build\lib.win-amd64-3.7\test
copying test\utils.py -> build\lib.win-amd64-3.7\test
copying test__init__.py -> build\lib.win-amd64-3.7\test
creating build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\add.py -> build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\div.py -> build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\max.py -> build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\mean.py -> build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\min.py -> build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\mul.py -> build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\std.py -> build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\sub.py -> build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter__init__.py -> build\lib.win-amd64-3.7\torch_scatter
creating build\lib.win-amd64-3.7\torch_scatter\utils
copying torch_scatter\utils\ext.py -> build\lib.win-amd64-3.7\torch_scatter\utils
copying torch_scatter\utils\gen.py -> build\lib.win-amd64-3.7\torch_scatter\utils
copying torch_scatter\utils__init__.py -> build\lib.win-amd64-3.7\torch_scatter\utils
running build_ext
C:\Anaconda3\lib\site-packages\torch\utils\cpp_extension.py:189: UserWarning: Error checking compiler version for g++: Command 'g++' returned non-zero exit status 1.
warnings.warn('Error checking compiler version for {}: {}'.format(compiler, error))
It seems that the problem is solved, referring to
https://github.com/rusty1s/pytorch_geometric/issues/667
copy the sources
git clone https://github.com/rusty1s/pytorch_scatter.git
git clone https://github.com/rusty1s/pytorch_cluster.git
git clone https://github.com/rusty1s/pytorch_sparse.git
git clone https://github.com/rusty1s/pytorch_spline_conv.git
cd /d your directory
python setup.py build --compiler=msvc
python setup.py install
It works for the sample code:
import torch
from torch.nn import Sequential as Seq, Linear as Lin, ReLU
from torch_geometric.nn import MessagePassing
class EdgeConv(MessagePassing):
def __init__(self, F_in, F_out):
super(EdgeConv, self).__init__(aggr='max') # "Max" aggregation.
self.mlp = Seq(Lin(2 * F_in, F_out), ReLU(), Lin(F_out, F_out))
def forward(self, x, edge_index):
# x has shape [N, F_in]
# edge_index has shape [2, E]
return self.propagate(edge_index, x=x) # shape [N, F_out]
def message(self, x_i, x_j):
# x_i has shape [E, F_in]
# x_j has shape [E, F_in]
edge_features = torch.cat([x_i, x_j - x_i], dim=1) # shape [E, 2 * F_in]
return self.mlp(edge_features) # shape [E, F_out]
Most helpful comment
It seems that the problem is solved, referring to
https://github.com/rusty1s/pytorch_geometric/issues/667
copy the sources
git clone https://github.com/rusty1s/pytorch_scatter.git
git clone https://github.com/rusty1s/pytorch_cluster.git
git clone https://github.com/rusty1s/pytorch_sparse.git
git clone https://github.com/rusty1s/pytorch_spline_conv.git
cd /d your directory
python setup.py build --compiler=msvc
python setup.py install
It works for the sample code: