2021-11-13

2021-11-13,第1张

2021-11-13

PyG安装中的某些问题

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

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

(PyG37) C:UsersASUS>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:AnacondaenvsPyG37python.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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:UsersASUSAppDataLocalTemppip-wheel-snlya87o'
       cwd: C:UsersASUSAppDataLocalTemppip-install-trvunnu_torch-scatter_512b8eceab264f7cb0df6d706c97bffa
  Complete output (29 lines):
  D:AnacondaenvsPyG37libsite-packagessetuptoolsdist.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 buildlib.win-amd64-3.7
  creating buildlib.win-amd64-3.7torch_scatter
  copying torch_scatterplaceholder.py -> buildlib.win-amd64-3.7torch_scatter
  copying torch_scatterscatter.py -> buildlib.win-amd64-3.7torch_scatter
  copying torch_scattersegment_coo.py -> buildlib.win-amd64-3.7torch_scatter
  copying torch_scattersegment_csr.py -> buildlib.win-amd64-3.7torch_scatter
  copying torch_scatterutils.py -> buildlib.win-amd64-3.7torch_scatter
  copying torch_scatter__init__.py -> buildlib.win-amd64-3.7torch_scatter
  creating buildlib.win-amd64-3.7torch_scattercomposite
  copying torch_scattercompositelogsumexp.py -> buildlib.win-amd64-3.7torch_scattercomposite
  copying torch_scattercompositesoftmax.py -> buildlib.win-amd64-3.7torch_scattercomposite
  copying torch_scattercompositestd.py -> buildlib.win-amd64-3.7torch_scattercomposite
  copying torch_scattercomposite__init__.py -> buildlib.win-amd64-3.7torch_scattercomposite
  running build_ext
  D:AnacondaenvsPyG37libsite-packagestorchutilscpp_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:AnacondaenvsPyG37libsite-packagescoloramaansitowin32.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:AnacondaenvsPyG37python.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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersASUSAppDataLocalTemppip-record-she8f487install-record.txt' --single-version-externally-managed --compile --install-headers 'D:AnacondaenvsPyG37Includetorch-scatter'
         cwd: C:UsersASUSAppDataLocalTemppip-install-trvunnu_torch-scatter_512b8eceab264f7cb0df6d706c97bffa
    Complete output (29 lines):
    D:AnacondaenvsPyG37libsite-packagessetuptoolsdist.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 buildlib.win-amd64-3.7
    creating buildlib.win-amd64-3.7torch_scatter
    copying torch_scatterplaceholder.py -> buildlib.win-amd64-3.7torch_scatter
    copying torch_scatterscatter.py -> buildlib.win-amd64-3.7torch_scatter
    copying torch_scattersegment_coo.py -> buildlib.win-amd64-3.7torch_scatter
    copying torch_scattersegment_csr.py -> buildlib.win-amd64-3.7torch_scatter
    copying torch_scatterutils.py -> buildlib.win-amd64-3.7torch_scatter
    copying torch_scatter__init__.py -> buildlib.win-amd64-3.7torch_scatter
    creating buildlib.win-amd64-3.7torch_scattercomposite
    copying torch_scattercompositelogsumexp.py -> buildlib.win-amd64-3.7torch_scattercomposite
    copying torch_scattercompositesoftmax.py -> buildlib.win-amd64-3.7torch_scattercomposite
    copying torch_scattercompositestd.py -> buildlib.win-amd64-3.7torch_scattercomposite
    copying torch_scattercomposite__init__.py -> buildlib.win-amd64-3.7torch_scattercomposite
    running build_ext
    D:AnacondaenvsPyG37libsite-packagestorchutilscpp_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:AnacondaenvsPyG37libsite-packagescoloramaansitowin32.py", line 59, in closed
        return stream.closed
    ValueError: underlying buffer has been detached
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'D:AnacondaenvsPyG37python.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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersASUSAppDataLocalTemppip-record-she8f487install-record.txt' --single-version-externally-managed --compile --install-headers 'D:AnacondaenvsPyG37Includetorch-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:UsersASUS>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:AnacondaenvsPyG37python.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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:UsersASUSAppDataLocalTemppip-wheel-s2q_yecp'
       cwd: C:UsersASUSAppDataLocalTemppip-install-vwid4lrctorch-scatter_721ccabdaace4805a3e81265357e2e43
  Complete output (29 lines):
  D:AnacondaenvsPyG37libsite-packagessetuptoolsdist.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:UsersASUS>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:AnacondaenvsPyG37python.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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:UsersASUSAppDataLocalTemppip-wheel-9xx3cb1y'
       cwd: C:UsersASUSAppDataLocalTemppip-install-_g316y1ptorch-scatter_a4db3e38ebb94b79b36460dbca3e6c7d
  Complete output (394 lines):
  D:AnacondaenvsPyG37libsite-packagessetuptoolsdist.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:UsersASUS>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:UsersASUS>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:UsersASUS>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:UsersASUS>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
>>>

结束了,结束了。累

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5480588.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-12
下一篇 2022-12-12

发表评论

登录后才能评论

评论列表(0条)

保存