5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

pip3 install torchがなぜか失敗する問題を解決した時の備忘録

Last updated at Posted at 2022-02-22

ある日pip3 install torchするもなぜか失敗する

$ pip3 install torch
Defaulting to user installation because normal site-packages is not writeable
Collecting torch
  Downloading torch-1.10.2-cp39-cp39-manylinux1_x86_64.whl (881.9 MB)
Killed
$ python -c "import torch"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'torch'

色々調べるも分からない。
もしかして最新のpytorchのバージョンが上がってずれてるのかも?と思いサイトを確認すると以下で1.10になっているようだった。

https://pytorch.org/blog/pytorch-1.10-released/
https://github.com/pytorch/pytorch/releases
22 Oct 2021 PyTorch 1.10 Release, including CUDA Graphs APIs, Frontend and compiler improvements

という事でパッケージをアップデート

$ pip install -U pip

インストール再チャレンジ

$ pip install torch
Defaulting to user installation because normal site-packages is not writeable
Collecting torch
  Downloading torch-1.10.2-cp39-cp39-manylinux1_x86_64.whl (881.9 MB)
     \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 881.9/881.9 MB ? eta 0:00:00
Collecting typing-extensions
  Downloading typing_extensions-4.1.1-py3-none-any.whl (26 kB)
Installing collected packages: typing-extensions, torch
  WARNING: The scripts convert-caffe2-to-onnx, convert-onnx-to-caffe2 and torchrun are installed in '/home/ubuntu/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed torch-1.10.2 typing-extensions-4.1.1
$ python -c "import torch"

成功した!よかった!

参考

https://pytorch.org/blog/pytorch-1.10-released/

5
2
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
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?