LoginSignup
0
1

More than 3 years have passed since last update.

PyTorch 1.7でtorch-scatterをインストール

Last updated at Posted at 2020-11-12

環境

  • Windows 10
  • python 3.6.11
  • Pytorch 1.7.0
  • torch-scatter 2.0.5

取り急ぎ成功したので急いでメモ。

$ pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.7.0.html
Looking in links: https://pytorch-geometric.com/whl/torch-1.7.0.html
Collecting torch-scatter
  Downloading https://pytorch-geometric.com/whl/torch-1.7.0/torch_scatter-2.0.5%2Bcu110-cp36-cp36m-win_amd64.whl (2.4
MB)
     |████████████████████████████████| 2.4 MB 544 kB/s
Installing collected packages: torch-scatter
Successfully installed torch-scatter-2.0.5

しかし動かそうとすると失敗

$ python natura/bin/pytorch_sample.py
Traceback (most recent call last):
  File "natura/bin/pytorch_sample.py", line 9, in <module>
    from torch_scatter import scatter_max
  File "C:\Users\dff40\.conda\envs\pytorch04gpu\lib\site-packages\torch_scatter\__init__.py", line 12, in <module>
    library, [osp.dirname(__file__)]).origin)
  File "C:\Users\dff40\.conda\envs\pytorch04gpu\lib\site-packages\torch\_ops.py", line 105, in load_library
    ctypes.CDLL(path)
  File "C:\Users\dff40\.conda\envs\pytorch04gpu\lib\ctypes\__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] 指定されたモジュールが見つかりません。
(pytorch04gpu)

あきらめず

エラー内容はGPU関連っぽい。CPU版をインストールすればよいかも。そこでアンインストールして以下を実行

$ pip install torch-scatter==latest+cpu -f https://pytorch-geometric.com/whl/torch-1.7.0.html
Looking in links: https://pytorch-geometric.com/whl/torch-1.7.0.html
Collecting torch-scatter==latest+cpu
  Downloading https://pytorch-geometric.com/whl/torch-1.7.0/torch_scatter-latest%2Bcpu-cp36-cp36m-win_amd64.whl (289 k
B)
     |████████████████████████████████| 289 kB 364 kB/s
Installing collected packages: torch-scatter
Successfully installed torch-scatter-2.0.5

これでさっきのコマンドを動かすと無事動いた!

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1