问题描述:
安装pytorch-geometric-temporal总是报错,报错如下:
(pytorchGT) C:\Users\A>pip install torch_scatter
Collecting torch_scatter
Using cached torch_scatter-2.1.1.tar.gz (107 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: torch_scatter
Building wheel for torch_scatter (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [33 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-38
creating build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\placeholder.py -> build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\scatter.py -> build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\segment_coo.py -> build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\segment_csr.py -> build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\testing.py -> build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\utils.py -> build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\__init__.py -> build\lib.win-amd64-cpython-38\torch_scatter
creating build\lib.win-amd64-cpython-38\torch_scatter\composite
copying torch_scatter\composite\logsumexp.py -> build\lib.win-amd64-cpython-38\torch_scatter\composite
copying torch_scatter\composite\softmax.py -> build\lib.win-amd64-cpython-38\torch_scatter\composite
copying torch_scatter\composite\std.py -> build\lib.win-amd64-cpython-38\torch_scatter\composite
copying torch_scatter\composite\__init__.py -> build\lib.win-amd64-cpython-38\torch_scatter\composite
running egg_info
writing torch_scatter.egg-info\PKG-INFO
writing dependency_links to torch_scatter.egg-info\dependency_links.txt
writing requirements to torch_scatter.egg-info\requires.txt
writing top-level names to torch_scatter.egg-info\top_level.txt
reading manifest file 'torch_scatter.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*' found under directory 'test'
adding license file 'LICENSE'
writing manifest file 'torch_scatter.egg-info\SOURCES.txt'
running build_ext
E:\SoftWares\anaconda3\envs\pytorchGT\lib\site-packages\torch\utils\cpp_extension.py:316: 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/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
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: subprocess-exited-with-error
× Running setup.py install for torch_scatter did not run successfully.
│ exit code: 1
╰─> [35 lines of output]
running install
E:\SoftWares\anaconda3\envs\pytorchGT\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-38
creating build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\placeholder.py -> build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\scatter.py -> build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\segment_coo.py -> build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\segment_csr.py -> build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\testing.py -> build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\utils.py -> build\lib.win-amd64-cpython-38\torch_scatter
copying torch_scatter\__init__.py -> build\lib.win-amd64-cpython-38\torch_scatter
creating build\lib.win-amd64-cpython-38\torch_scatter\composite
copying torch_scatter\composite\logsumexp.py -> build\lib.win-amd64-cpython-38\torch_scatter\composite
copying torch_scatter\composite\softmax.py -> build\lib.win-amd64-cpython-38\torch_scatter\composite
copying torch_scatter\composite\std.py -> build\lib.win-amd64-cpython-38\torch_scatter\composite
copying torch_scatter\composite\__init__.py -> build\lib.win-amd64-cpython-38\torch_scatter\composite
running egg_info
writing torch_scatter.egg-info\PKG-INFO
writing dependency_links to torch_scatter.egg-info\dependency_links.txt
writing requirements to torch_scatter.egg-info\requires.txt
writing top-level names to torch_scatter.egg-info\top_level.txt
reading manifest file 'torch_scatter.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*' found under directory 'test'
adding license file 'LICENSE'
writing manifest file 'torch_scatter.egg-info\SOURCES.txt'
running build_ext
E:\SoftWares\anaconda3\envs\pytorchGT\lib\site-packages\torch\utils\cpp_extension.py:316: 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/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> torch_scatter
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
解决方案:
缺少torch_scatter和torch_sparse,这两个文件由于已经安装pytorch而无法pip 安装,需要自己下安装包去安装,
下载两个文件,按照这个博客一步步操作就行
https://blog.csdn.net/qq_43481435/article/details/127212104