Unable to install PyTorch - ERROR: Command errored out with exit status 1:

1

I am trying to work with python zincbase and need to install pytorch on windows for that. When executing

pip install torch

I get an error saying

ERROR: Command errored out with exit status 1:
command: 'c:\data-nobackup\development\im-099329- 
gremlintest\env\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\104172\\AppData\\Local\\Temp\\pip-install-5go0i_r_\\torch\\setup.py'"'"'; __file__='"'"'C:\\Users\\104172\\AppData\\Local\\Temp\\pip-install-5go0i_r_\\torch\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\104172\AppData\Local\Temp\pip-wheel-bk0m_2ck' --python-tag cp36
   cwd: C:\Users\104172\AppData\Local\Temp\pip-install-5go0i_r_\torch\
  Complete output (30 lines):
  running bdist_wheel
  running build
  running build_deps
  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\104172\AppData\Local\Temp\pip-install-5go0i_r_\torch\setup.py", line 265, in <module>
  description="Tensors and Dynamic neural networks in Python with strong GPU acceleration",
File "c:\data-nobackup\development\im-099329-gremlintest\env\lib\site-packages\setuptools\__init__.py", line 145, in setup
  return distutils.core.setup(**attrs)
File "c:\customsoftware\python3.6\Lib\distutils\core.py", line 148, in setup
  dist.run_commands()
File "c:\customsoftware\python3.6\Lib\distutils\dist.py", line 955, in run_commands
  self.run_command(cmd)
File "c:\customsoftware\python3.6\Lib\distutils\dist.py", line 974, in run_command
  cmd_obj.run()
File "c:\data-nobackup\development\im-099329-gremlintest\env\lib\site-packages\wheel\bdist_wheel.py", line 192, in run
  self.run_command('build')
File "c:\customsoftware\python3.6\Lib\distutils\cmd.py", line 313, in run_command
  self.distribution.run_command(command)
File "c:\customsoftware\python3.6\Lib\distutils\dist.py", line 974, in run_command
  cmd_obj.run()
File "c:\customsoftware\python3.6\Lib\distutils\command\build.py", line 135, in run
  self.run_command(cmd_name)
File "c:\customsoftware\python3.6\Lib\distutils\cmd.py", line 313, in run_command
  self.distribution.run_command(command)
File "c:\customsoftware\python3.6\Lib\distutils\dist.py", line 974, in run_command
  cmd_obj.run()
File "C:\Users\104172\AppData\Local\Temp\pip-install-5go0i_r_\torch\setup.py", line 51, in run
  from tools.nnwrap import generate_wrappers as generate_nn_wrappers
  ModuleNotFoundError: No module named 'tools.nnwrap'

  ERROR: Failed building wheel for torch

How can I install pytorch?

Donna Schweitzer

Posted 2019-08-16T09:39:30.780

Reputation: 11

You won't be able to install PyTorch on windows via pip, as there are no prebuilt packages on PyPI for windows (and the one source dist pip finds is way too outdated). You should use Anaconda on Windows and install from PyTorch official channel. – hoefling – 2019-08-19T11:25:47.377

Answers

1

Unlike other libraries, we can't just install pytorch locally with pip install torch command.

Go to pytorch.org website and choose your machine and environment and it will provide you the command to run, like this "pip3 install torch===1.2.0 torchvision===0.4.0 -f https://download.pytorch.org/whl/torch_stable.html"

or you can also do:

Python 3.7

pip3 install https://download.pytorch.org/whl/cpu/torch-1.0.1-cp37-cp37m-win_amd64.whl pip3 install torchvision

Sachin Cholkar

Posted 2019-08-16T09:39:30.780

Reputation: 11

0

You can simply visit the PyTorch website at pytorch.org

Then go to the "Get started" page. You will see an interesting online tool in which you can select different options and it will provide a proper command to install "torch".

Just like the following picture:

enter image description here

As you can see with the above selection, the following command for torch installation would be the result:

pip3 install torch==1.3.1+cpu torchvision==0.4.2+cpu -f https://download.pytorch.org/whl/torch_stable.html

K. Aslansefat

Posted 2019-08-16T09:39:30.780

Reputation: 1