ComputerVision-with-PyTorch-Learning-Program icon indicating copy to clipboard operation
ComputerVision-with-PyTorch-Learning-Program copied to clipboard

Error installing Pytorch

Open IamAbhinav03 opened this issue 5 years ago • 11 comments

Specific Question

I have an error while installing PyTorch

OS, package manager and PyTorch Version

  • OS -Windows 7 32-bit
  • PyTorch Version -Stable(1.5)
  • Package Manager - Pip

Complete Error Log

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\user>pip install torch==1.5.0+cpu torchvision==0.6.0+cpu -f https://dow
nload.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
ERROR: Could not find a version that satisfies the requirement torch==1.5.0+cpu
(from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch==1.5.0+cpu

C:\Users\user>

IamAbhinav03 avatar Jun 06 '20 16:06 IamAbhinav03

I too got this error. Found this on the website Screenshot (11)

abhinavk001 avatar Jun 07 '20 06:06 abhinavk001

Will it work on Ubuntu 14.04?

IamAbhinav03 avatar Jun 07 '20 07:06 IamAbhinav03

Try

pip install torch torchvision 

gksoriginals avatar Jun 07 '20 12:06 gksoriginals

@GopikrishnanSasikumar
Is the command for Ubuntu or Windows?? I tried to run it in windows some packages got installed and then I got a long error

Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\user>pip install torch torchvision
Collecting torch
  Downloading torch-0.1.2.post2.tar.gz (128 kB)
     |████████████████████████████████| 128 kB 85 kB/s
Collecting torchvision
  Downloading torchvision-0.2.2.post3-py2.py3-none-any.whl (64 kB)
     |████████████████████████████████| 64 kB 108 kB/s
Collecting pyyaml
  Downloading PyYAML-5.3.1-cp37-cp37m-win32.whl (196 kB)
     |████████████████████████████████| 196 kB 243 kB/s
Collecting pillow>=4.1.1
  Downloading Pillow-7.1.2-cp37-cp37m-win32.whl (1.8 MB)
     |████████████████████████████████| 1.8 MB 469 kB/s
Requirement already satisfied: numpy in c:\users\user\appdata\local\programs\pyt
hon\python37-32\lib\site-packages (from torchvision) (1.18.4)
Requirement already satisfied: six in c:\users\user\appdata\roaming\python\pytho
n37\site-packages (from torchvision) (1.12.0)
Building wheels for collected packages: torch
  Building wheel for torch (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\user\appdata\local\programs\python\python37-32\python.exe'
 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\Ap
pData\\Local\\Temp\\pip-install-aiestgs7\\torch\\setup.py'"'"'; __file__='"'"'C:
\\Users\\user\\AppData\\Local\\Temp\\pip-install-aiestgs7\\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\user\AppData\Local\Temp\pip-wheel-ziqou_b9'
       cwd: C:\Users\user\AppData\Local\Temp\pip-install-aiestgs7\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\user\AppData\Local\Temp\pip-install-aiestgs7\torch\setup.py",
 line 265, in <module>
      description="Tensors and Dynamic neural networks in Python with strong GPU
 acceleration",
    File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packa
ges\setuptools\__init__.py", line 145, in setup
      return distutils.core.setup(**attrs)
    File "c:\users\user\appdata\local\programs\python\python37-32\lib\distutils\
core.py", line 148, in setup
      dist.run_commands()
    File "c:\users\user\appdata\local\programs\python\python37-32\lib\distutils\
dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "c:\users\user\appdata\local\programs\python\python37-32\lib\distutils\
dist.py", line 985, in run_command
      cmd_obj.run()
    File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packa
ges\wheel\bdist_wheel.py", line 192, in run
      self.run_command('build')
    File "c:\users\user\appdata\local\programs\python\python37-32\lib\distutils\
cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "c:\users\user\appdata\local\programs\python\python37-32\lib\distutils\
dist.py", line 985, in run_command
      cmd_obj.run()
    File "c:\users\user\appdata\local\programs\python\python37-32\lib\distutils\
command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "c:\users\user\appdata\local\programs\python\python37-32\lib\distutils\
cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "c:\users\user\appdata\local\programs\python\python37-32\lib\distutils\
dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\user\AppData\Local\Temp\pip-install-aiestgs7\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
  Running setup.py clean for torch
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\user\appdata\local\programs\python\python37-32\python.exe'
 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\Ap
pData\\Local\\Temp\\pip-install-aiestgs7\\torch\\setup.py'"'"'; __file__='"'"'C:
\\Users\\user\\AppData\\Local\\Temp\\pip-install-aiestgs7\\torch\\setup.py'"'"';
f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\
r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
 clean --all
       cwd: C:\Users\user\AppData\Local\Temp\pip-install-aiestgs7\torch
  Complete output (2 lines):
  running clean
  error: [Errno 2] No such file or directory: '.gitignore'
  ----------------------------------------
  ERROR: Failed cleaning build dir for torch
Failed to build torch
Installing collected packages: pyyaml, torch, pillow, torchvision
    Running setup.py install for torch ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\user\appdata\local\programs\python\python37-32\python.ex
e' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\
AppData\\Local\\Temp\\pip-install-aiestgs7\\torch\\setup.py'"'"'; __file__='"'"'
C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-aiestgs7\\torch\\setup.py'"'"
';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"
'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"')
)' install --record 'C:\Users\user\AppData\Local\Temp\pip-record-jmx5slnq\instal
l-record.txt' --single-version-externally-managed --compile --install-headers 'c
:\users\user\appdata\local\programs\python\python37-32\Include\torch'
         cwd: C:\Users\user\AppData\Local\Temp\pip-install-aiestgs7\torch\
    Complete output (23 lines):
    running install
    running build_deps
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\user\AppData\Local\Temp\pip-install-aiestgs7\torch\setup.py
", line 265, in <module>
        description="Tensors and Dynamic neural networks in Python with strong G
PU acceleration",
      File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-pac
kages\setuptools\__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "c:\users\user\appdata\local\programs\python\python37-32\lib\distutil
s\core.py", line 148, in setup
        dist.run_commands()
      File "c:\users\user\appdata\local\programs\python\python37-32\lib\distutil
s\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "c:\users\user\appdata\local\programs\python\python37-32\lib\distutil
s\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\user\AppData\Local\Temp\pip-install-aiestgs7\torch\setup.py
", line 99, in run
        self.run_command('build_deps')
      File "c:\users\user\appdata\local\programs\python\python37-32\lib\distutil
s\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\users\user\appdata\local\programs\python\python37-32\lib\distutil
s\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\user\AppData\Local\Temp\pip-install-aiestgs7\torch\setup.py
", line 51, in run
        from tools.nnwrap import generate_wrappers as generate_nn_wrappers
    ModuleNotFoundError: No module named 'tools.nnwrap'
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\user\appdata\local\prog
rams\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys
.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-aiestgs7\\tor
ch\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-inst
all-aiestgs7\\torch\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__f
ile__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compil
e(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\user\AppData\Loca
l\Temp\pip-record-jmx5slnq\install-record.txt' --single-version-externally-manag
ed --compile --install-headers 'c:\users\user\appdata\local\programs\python\pyth
on37-32\Include\torch' Check the logs for full command output.

C:\Users\user>

IamAbhinav03 avatar Jun 07 '20 14:06 IamAbhinav03

@Thelonenlyhobbist can you try out the solution given in the first answer of this stackoverflow post ?

https://stackoverflow.com/questions/56859803/modulenotfounderror-no-module-named-tools-nnwrap

gksoriginals avatar Jun 07 '20 15:06 gksoriginals

I tried that but I still got an error. I think the commands given in the links are for AMD based processors

IamAbhinav03 avatar Jun 07 '20 16:06 IamAbhinav03

@Thelonenlyhobbist I don’t know how to fix this. Do you have a Linux distro in your system ?

gksoriginals avatar Jun 07 '20 16:06 gksoriginals

Yeah. I have an Ubuntu 14.04

IamAbhinav03 avatar Jun 07 '20 16:06 IamAbhinav03

@Thelonenlyhobbist can you try installing PyTorch there ? Since I am not using a windows machine I am not familiar with this particular issue.

gksoriginals avatar Jun 07 '20 16:06 gksoriginals

@Thelonenlyhobbist can you check below answer in Stackoverflow:

https://stackoverflow.com/questions/48109783/pytorch-installation-in-windows-7-32-bit-sysytem

kurianbenoy avatar Jun 08 '20 14:06 kurianbenoy

@Thelonenlyhobbist were you able to fix this ?

gksoriginals avatar Jun 13 '20 15:06 gksoriginals