Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows keeps crashing when trying to install PyTorch via pip

I am currently trying to install PyTorch (using the installation commands posted on PyTorch.org for pip) and when I run the command, my computer completely freezes.

I tried this multiple times with the same result. I had to restart the computer a few times as well. On my current try, I put "-v" when trying to install and the pip seems to be stuck on "Looking up in the cache".

I do not know how to proceed. As I mentioned, I've already tried this method multiple times. It worked the first time but did not install PyTorch as it gave me an error for not using "--user".

Are there any solutions to this?

EDIT: I did want to add that I have Python 3.8.6 (64bit)

like image 250
Pshivvy Avatar asked Nov 15 '20 22:11

Pshivvy


People also ask

Can I install PyTorch using PIP?

To install PyTorch via pip, and do have a CUDA-capable system, in the above selector, choose OS: Linux, Package: Pip and the CUDA version suited to your machine. Often, the latest CUDA version is better. Then, run the command that is presented to you.

Does Python 3.10 support PyTorch?

We've just released a new version of fastai, which adds support for pytorch 1.11 (which means fastai now supports python 3.10).

Why can't I install torch?

As of August 2021, users can no longer download Torch. When users try to download Torch, they are redirected to install Avast Secure Browser. Like Torch, Avast is a Chromium-built browser, but that's where their similarities end.


1 Answers

After troubling shooting and a lot of restart, it seems like the issue came from when pip was trying to load a pre-downloaded file. Essentially, the first time I ran the installation command, pip downloaded files for pytorch but did not install pytorch due to some user privilege issue. The fix is to add --no-cache-dir in the pip install command. This will override the cache (pre-downloaded files) and download the files all over again.

For me specifically, I also needed to add --user.

In other words, the command went from

pip install torch===1.7.0+cu110 torchvision===0.8.1+cu110 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html

to

pip --no-cache-dir install torch===1.7.0+cu110 torchvision===0.8.1+cu110 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html --user
like image 179
Pshivvy Avatar answered Nov 15 '22 00:11

Pshivvy