目前配置,cuda=11.1+与之匹配的cudnn+python3.7+pytorch1.8.0
由于我是在anaconda里面装的,前面的步骤还算愉快,然后一到PyG的安装就开始挑战我的心态了。。。
(PyG37) C:\Users\ASUS>pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.8.0+cu111.html
Looking in links: https://pytorch-geometric.com/whl/torch-1.8.0+cu111.html
Collecting torch-scatter
Using cached torch_scatter-2.0.9.tar.gz (21 kB)
Building wheels for collected packages: torch-scatter
Building wheel for torch-scatter (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'D:\Anaconda\envs\PyG37\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ASUS\\AppData\\Local\\Temp\\pip-install-trvunnu_\\torch-scatter_512b8eceab264f7cb0df6d706c97bffa\\setup.py'"'"'; __file__='"'"'C:\\Users\\ASUS\\AppData\\Local\\Temp\\pip-install-trvunnu_\\torch-scatter_512b8eceab264f7cb0df6d706c97bffa\\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'"'"'))' bdist_wheel -d 'C:\Users\ASUS\AppData\Local\Temp\pip-wheel-snlya87o'
cwd: C:\Users\ASUS\AppData\Local\Temp\pip-install-trvunnu_\torch-scatter_512b8eceab264f7cb0df6d706c97bffa\
Complete output (29 lines):
D:\Anaconda\envs\PyG37\lib\site-packages\setuptools\dist.py:720: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
% (opt, underscore_opt)
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\placeholder.py -> build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\scatter.py -> build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\segment_coo.py -> build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\segment_csr.py -> build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\utils.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\composite
copying torch_scatter\composite\logsumexp.py -> build\lib.win-amd64-3.7\torch_scatter\composite
copying torch_scatter\composite\softmax.py -> build\lib.win-amd64-3.7\torch_scatter\composite
copying torch_scatter\composite\std.py -> build\lib.win-amd64-3.7\torch_scatter\composite
copying torch_scatter\composite\__init__.py -> build\lib.win-amd64-3.7\torch_scatter\composite
running build_ext
D:\Anaconda\envs\PyG37\lib\site-packages\torch\utils\cpp_extension.py:304: UserWarning: Error checking compiler version for cl: [WinError 2] 系统找不到指定的文件。
warnings.warn(f'Error checking compiler version for {compiler}: {error}')
building 'torch_scatter._scatter_cpu' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "D:\Anaconda\envs\PyG37\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
return stream.closed
ValueError: underlying buffer has been detached
----------------------------------------
ERROR: Failed building wheel for torch-scatter
Running setup.py clean for torch-scatter
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: 'D:\Anaconda\envs\PyG37\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ASUS\\AppData\\Local\\Temp\\pip-install-trvunnu_\\torch-scatter_512b8eceab264f7cb0df6d706c97bffa\\setup.py'"'"'; __file__='"'"'C:\\Users\\ASUS\\AppData\\Local\\Temp\\pip-install-trvunnu_\\torch-scatter_512b8eceab264f7cb0df6d706c97bffa\\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\ASUS\AppData\Local\Temp\pip-record-she8f487\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Anaconda\envs\PyG37\Include\torch-scatter'
cwd: C:\Users\ASUS\AppData\Local\Temp\pip-install-trvunnu_\torch-scatter_512b8eceab264f7cb0df6d706c97bffa\
Complete output (29 lines):
D:\Anaconda\envs\PyG37\lib\site-packages\setuptools\dist.py:720: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
% (opt, underscore_opt)
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\placeholder.py -> build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\scatter.py -> build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\segment_coo.py -> build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\segment_csr.py -> build\lib.win-amd64-3.7\torch_scatter
copying torch_scatter\utils.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\composite
copying torch_scatter\composite\logsumexp.py -> build\lib.win-amd64-3.7\torch_scatter\composite
copying torch_scatter\composite\softmax.py -> build\lib.win-amd64-3.7\torch_scatter\composite
copying torch_scatter\composite\std.py -> build\lib.win-amd64-3.7\torch_scatter\composite
copying torch_scatter\composite\__init__.py -> build\lib.win-amd64-3.7\torch_scatter\composite
running build_ext
D:\Anaconda\envs\PyG37\lib\site-packages\torch\utils\cpp_extension.py:304: UserWarning: Error checking compiler version for cl: [WinError 2] 系统找不到指定的文件。
warnings.warn(f'Error checking compiler version for {compiler}: {error}')
building 'torch_scatter._scatter_cpu' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "D:\Anaconda\envs\PyG37\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
return stream.closed
ValueError: underlying buffer has been detached
----------------------------------------
ERROR: Command errored out with exit status 1: 'D:\Anaconda\envs\PyG37\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ASUS\\AppData\\Local\\Temp\\pip-install-trvunnu_\\torch-scatter_512b8eceab264f7cb0df6d706c97bffa\\setup.py'"'"'; __file__='"'"'C:\\Users\\ASUS\\AppData\\Local\\Temp\\pip-install-trvunnu_\\torch-scatter_512b8eceab264f7cb0df6d706c97bffa\\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\ASUS\AppData\Local\Temp\pip-record-she8f487\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Anaconda\envs\PyG37\Include\torch-scatter' Check the logs for full command output.
中间大段大段的错误,我一看。哦豁,这是Microsoft Visual C++ 14.0 or greater is required.没装,然后辗转在csdn中四处搜寻。好家伙,全都是包损坏,奈何我又没办法翻墙。
终于辗转找到了这篇博客:
(已解决)win10安装visual studio C++ build tools 提示安装包丢失或毁坏_Zhou_Yulong的博客-CSDN博客
解决了,我应该可以安装scatter了吧,然后就是这样。。。
不死心的我换了pip install等命令,均以失败告终
(PyG37) C:\Users\ASUS>pip install torch-scatter
Collecting torch-scatter
Using cached torch_scatter-2.0.9.tar.gz (21 kB)
Building wheels for collected packages: torch-scatter
Building wheel for torch-scatter (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'D:\Anaconda\envs\PyG37\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ASUS\\AppData\\Local\\Temp\\pip-install-vwid4lrc\\torch-scatter_721ccabdaace4805a3e81265357e2e43\\setup.py'"'"'; __file__='"'"'C:\\Users\\ASUS\\AppData\\Local\\Temp\\pip-install-vwid4lrc\\torch-scatter_721ccabdaace4805a3e81265357e2e43\\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'"'"'))' bdist_wheel -d 'C:\Users\ASUS\AppData\Local\Temp\pip-wheel-s2q_yecp'
cwd: C:\Users\ASUS\AppData\Local\Temp\pip-install-vwid4lrc\torch-scatter_721ccabdaace4805a3e81265357e2e43\
Complete output (29 lines):
D:\Anaconda\envs\PyG37\lib\site-packages\setuptools\dist.py:720: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
(PyG37) C:\Users\ASUS>pip install torch-scatter -f https://data.pyg.org/whl/torch-1.8.0+cu111.html
Looking in links: https://data.pyg.org/whl/torch-1.8.0+cu111.html
Collecting torch-scatter
Using cached torch_scatter-2.0.9.tar.gz (21 kB)
Building wheels for collected packages: torch-scatter
Building wheel for torch-scatter (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'D:\Anaconda\envs\PyG37\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ASUS\\AppData\\Local\\Temp\\pip-install-_g316y1p\\torch-scatter_a4db3e38ebb94b79b36460dbca3e6c7d\\setup.py'"'"'; __file__='"'"'C:\\Users\\ASUS\\AppData\\Local\\Temp\\pip-install-_g316y1p\\torch-scatter_a4db3e38ebb94b79b36460dbca3e6c7d\\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'"'"'))' bdist_wheel -d 'C:\Users\ASUS\AppData\Local\Temp\pip-wheel-9xx3cb1y'
cwd: C:\Users\ASUS\AppData\Local\Temp\pip-install-_g316y1p\torch-scatter_a4db3e38ebb94b79b36460dbca3e6c7d\
Complete output (394 lines):
D:\Anaconda\envs\PyG37\lib\site-packages\setuptools\dist.py:720: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
(PyG37) C:\Users\ASUS>pip install torch-scatter==latest+cu111 -f https://pytorch-geometric.com/whl/torch-1.8.0.html
Looking in links: https://pytorch-geometric.com/whl/torch-1.8.0.html
ERROR: Could not find a version that satisfies the requirement torch-scatter==latest+cu111 (from versions: 0.3.0, 1.0.2, 1.0.3, 1.0.4, 1.1.0, 1.1.1, 1.1.2, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.0.9)
ERROR: No matching distribution found for torch-scatter==latest+cu111
然后逼得我上官网https://data.pyg.org/whl/
这里有一个问题,我并不确定这个包的版本是否匹配。。。大家注意辨别。(虽然测试没问题)
点击torch-1.8.0+cu111,下载了torch_scatter-2.0.8-cp37-cp37m-linux_x86_64.whl
然后用conda装whl文件,好嘛又报错。。。
(PyG37) C:\Users\ASUS>conda install D:\torch_scatter-2.0.8-cp37-cp37m-win_amd64
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- \torch_scatter-2.0.8-cp37-cp37m-win_amd64
Current channels:
- https://repo.anaconda.com/pkgs/main/win-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/win-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/msys2/win-64
- https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
然后我耍了个小聪明,换了pip.
(PyG37) C:\Users\ASUS>pip install D:\torch_scatter-2.0.8-cp37-cp37m-win_amd64.whl
Processing d:\torch_scatter-2.0.8-cp37-cp37m-win_amd64.whl
Installing collected packages: torch-scatter
Successfully installed torch-scatter-2.0.8
成功了!!!喜大普奔,喜大普奔。
测试了一下,没有报错了,说明scatter装好了。(但是注意,我是先把sparse等包都先装好的,只有scatter无法用官网命令直接装好)。如要测试,其他包需自行安装。可参照Installation — pytorch_geometric 2.0.2 documentation
(PyG37) C:\Users\ASUS>python
Python 3.7.11 (default, Jul 27 2021, 09:42:29) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch_geometric.transforms as T
>>>
>>> from torch_geometric.nn import GCNConv, ChebConv
>>>
结束了,结束了。累