当前位置:   article > 正文

PyG安装中scatter库无法安装的问题_building wheels for collected packages: torch-scat

building wheels for collected packages: torch-scatter building wheel for tor

目前配置,cuda=11.1+与之匹配的cudnn+python3.7+pytorch1.8.0

由于我是在anaconda里面装的,前面的步骤还算愉快,然后一到PyG的安装就开始挑战我的心态了。。。

  1. (PyG37) C:\Users\ASUS>pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.8.0+cu111.html
  2. Looking in links: https://pytorch-geometric.com/whl/torch-1.8.0+cu111.html
  3. Collecting torch-scatter
  4. Using cached torch_scatter-2.0.9.tar.gz (21 kB)
  5. Building wheels for collected packages: torch-scatter
  6. Building wheel for torch-scatter (setup.py) ... error
  7. ERROR: Command errored out with exit status 1:
  8. 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'
  9. cwd: C:\Users\ASUS\AppData\Local\Temp\pip-install-trvunnu_\torch-scatter_512b8eceab264f7cb0df6d706c97bffa\
  10. Complete output (29 lines):
  11. 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
  12. % (opt, underscore_opt)
  13. running bdist_wheel
  14. running build
  15. running build_py
  16. creating build
  17. creating build\lib.win-amd64-3.7
  18. creating build\lib.win-amd64-3.7\torch_scatter
  19. copying torch_scatter\placeholder.py -> build\lib.win-amd64-3.7\torch_scatter
  20. copying torch_scatter\scatter.py -> build\lib.win-amd64-3.7\torch_scatter
  21. copying torch_scatter\segment_coo.py -> build\lib.win-amd64-3.7\torch_scatter
  22. copying torch_scatter\segment_csr.py -> build\lib.win-amd64-3.7\torch_scatter
  23. copying torch_scatter\utils.py -> build\lib.win-amd64-3.7\torch_scatter
  24. copying torch_scatter\__init__.py -> build\lib.win-amd64-3.7\torch_scatter
  25. creating build\lib.win-amd64-3.7\torch_scatter\composite
  26. copying torch_scatter\composite\logsumexp.py -> build\lib.win-amd64-3.7\torch_scatter\composite
  27. copying torch_scatter\composite\softmax.py -> build\lib.win-amd64-3.7\torch_scatter\composite
  28. copying torch_scatter\composite\std.py -> build\lib.win-amd64-3.7\torch_scatter\composite
  29. copying torch_scatter\composite\__init__.py -> build\lib.win-amd64-3.7\torch_scatter\composite
  30. running build_ext
  31. D:\Anaconda\envs\PyG37\lib\site-packages\torch\utils\cpp_extension.py:304: UserWarning: Error checking compiler version for cl: [WinError 2] 系统找不到指定的文件。
  32. warnings.warn(f'Error checking compiler version for {compiler}: {error}')
  33. building 'torch_scatter._scatter_cpu' extension
  34. 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/
  35. Error in atexit._run_exitfuncs:
  36. Traceback (most recent call last):
  37. File "D:\Anaconda\envs\PyG37\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
  38. return stream.closed
  39. ValueError: underlying buffer has been detached
  40. ----------------------------------------
  41. ERROR: Failed building wheel for torch-scatter
  42. Running setup.py clean for torch-scatter
  43. Failed to build torch-scatter
  44. Installing collected packages: torch-scatter
  45. Running setup.py install for torch-scatter ... error
  46. ERROR: Command errored out with exit status 1:
  47. 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'
  48. cwd: C:\Users\ASUS\AppData\Local\Temp\pip-install-trvunnu_\torch-scatter_512b8eceab264f7cb0df6d706c97bffa\
  49. Complete output (29 lines):
  50. 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
  51. % (opt, underscore_opt)
  52. running install
  53. running build
  54. running build_py
  55. creating build
  56. creating build\lib.win-amd64-3.7
  57. creating build\lib.win-amd64-3.7\torch_scatter
  58. copying torch_scatter\placeholder.py -> build\lib.win-amd64-3.7\torch_scatter
  59. copying torch_scatter\scatter.py -> build\lib.win-amd64-3.7\torch_scatter
  60. copying torch_scatter\segment_coo.py -> build\lib.win-amd64-3.7\torch_scatter
  61. copying torch_scatter\segment_csr.py -> build\lib.win-amd64-3.7\torch_scatter
  62. copying torch_scatter\utils.py -> build\lib.win-amd64-3.7\torch_scatter
  63. copying torch_scatter\__init__.py -> build\lib.win-amd64-3.7\torch_scatter
  64. creating build\lib.win-amd64-3.7\torch_scatter\composite
  65. copying torch_scatter\composite\logsumexp.py -> build\lib.win-amd64-3.7\torch_scatter\composite
  66. copying torch_scatter\composite\softmax.py -> build\lib.win-amd64-3.7\torch_scatter\composite
  67. copying torch_scatter\composite\std.py -> build\lib.win-amd64-3.7\torch_scatter\composite
  68. copying torch_scatter\composite\__init__.py -> build\lib.win-amd64-3.7\torch_scatter\composite
  69. running build_ext
  70. D:\Anaconda\envs\PyG37\lib\site-packages\torch\utils\cpp_extension.py:304: UserWarning: Error checking compiler version for cl: [WinError 2] 系统找不到指定的文件。
  71. warnings.warn(f'Error checking compiler version for {compiler}: {error}')
  72. building 'torch_scatter._scatter_cpu' extension
  73. 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/
  74. Error in atexit._run_exitfuncs:
  75. Traceback (most recent call last):
  76. File "D:\Anaconda\envs\PyG37\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
  77. return stream.closed
  78. ValueError: underlying buffer has been detached
  79. ----------------------------------------
  80. 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等命令,均以失败告终

  1. (PyG37) C:\Users\ASUS>pip install torch-scatter
  2. Collecting torch-scatter
  3. Using cached torch_scatter-2.0.9.tar.gz (21 kB)
  4. Building wheels for collected packages: torch-scatter
  5. Building wheel for torch-scatter (setup.py) ... error
  6. ERROR: Command errored out with exit status 1:
  7. 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'
  8. cwd: C:\Users\ASUS\AppData\Local\Temp\pip-install-vwid4lrc\torch-scatter_721ccabdaace4805a3e81265357e2e43\
  9. Complete output (29 lines):
  10. 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
  1. (PyG37) C:\Users\ASUS>pip install torch-scatter -f https://data.pyg.org/whl/torch-1.8.0+cu111.html
  2. Looking in links: https://data.pyg.org/whl/torch-1.8.0+cu111.html
  3. Collecting torch-scatter
  4. Using cached torch_scatter-2.0.9.tar.gz (21 kB)
  5. Building wheels for collected packages: torch-scatter
  6. Building wheel for torch-scatter (setup.py) ... error
  7. ERROR: Command errored out with exit status 1:
  8. 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'
  9. cwd: C:\Users\ASUS\AppData\Local\Temp\pip-install-_g316y1p\torch-scatter_a4db3e38ebb94b79b36460dbca3e6c7d\
  10. Complete output (394 lines):
  11. 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
  1. (PyG37) C:\Users\ASUS>pip install torch-scatter==latest+cu111 -f https://pytorch-geometric.com/whl/torch-1.8.0.html
  2. Looking in links: https://pytorch-geometric.com/whl/torch-1.8.0.html
  3. 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)
  4. 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文件,好嘛又报错。。。

  1. (PyG37) C:\Users\ASUS>conda install D:\torch_scatter-2.0.8-cp37-cp37m-win_amd64
  2. Collecting package metadata (current_repodata.json): done
  3. Solving environment: failed with initial frozen solve. Retrying with flexible solve.
  4. Collecting package metadata (repodata.json): done
  5. Solving environment: failed with initial frozen solve. Retrying with flexible solve.
  6. PackagesNotFoundError: The following packages are not available from current channels:
  7. - \torch_scatter-2.0.8-cp37-cp37m-win_amd64
  8. Current channels:
  9. - https://repo.anaconda.com/pkgs/main/win-64
  10. - https://repo.anaconda.com/pkgs/main/noarch
  11. - https://repo.anaconda.com/pkgs/r/win-64
  12. - https://repo.anaconda.com/pkgs/r/noarch
  13. - https://repo.anaconda.com/pkgs/msys2/win-64
  14. - https://repo.anaconda.com/pkgs/msys2/noarch
  15. To search for alternate channels that may provide the conda package you're
  16. looking for, navigate to
  17. https://anaconda.org
  18. and use the search bar at the top of the page.

 然后我耍了个小聪明,换了pip.

  1. (PyG37) C:\Users\ASUS>pip install D:\torch_scatter-2.0.8-cp37-cp37m-win_amd64.whl
  2. Processing d:\torch_scatter-2.0.8-cp37-cp37m-win_amd64.whl
  3. Installing collected packages: torch-scatter
  4. Successfully installed torch-scatter-2.0.8

成功了!!!喜大普奔,喜大普奔。

 测试了一下,没有报错了,说明scatter装好了。(但是注意,我是先把sparse等包都先装好的,只有scatter无法用官网命令直接装好)。如要测试,其他包需自行安装。可参照Installation — pytorch_geometric 2.0.2 documentation

  1. (PyG37) C:\Users\ASUS>python
  2. Python 3.7.11 (default, Jul 27 2021, 09:42:29) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
  3. Type "help", "copyright", "credits" or "license" for more information.
  4. >>> import torch_geometric.transforms as T
  5. >>>
  6. >>> from torch_geometric.nn import GCNConv, ChebConv
  7. >>>

结束了,结束了。累

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小惠珠哦/article/detail/1000180
推荐阅读
相关标签
  

闽ICP备14008679号