ModuleNotFoundError: No module named 'tools.nnwrap'

I am trying to install PyTorch but every time it throws the same error ( ModuleNotFoundError: No module named ‘tools.nnwrap’).
This is what is typed: pip install torch

This is what I get every time:
Collecting torch
Using cached https://files.pythonhosted.org/packages/f8/02/880b468bd382dc79896eaecbeb8ce95e9c4b99a24902874a2cef0b562cea/torch-0.1.2.post2.tar.gz
Requirement already satisfied: pyyaml in c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages (from torch) (5.1.2)
Installing collected packages: torch
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.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py’"’"’; file=’"’"‘C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\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-b_c49sh\install-record.txt’ --single-version-externally-managed --compile
cwd: C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch
Complete output (23 lines):
running install
running build_deps
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py”, line 265, in
description=“Tensors and Dynamic neural networks in Python with strong GPU acceleration”,
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\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\Temp\pip-install-oegjniuy\torch\setup.py”, line 99, in run
self.run_command(‘build_deps’)
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-oegjniuy\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\programs\python\python37-32\python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py’"’"’; file=’"’"‘C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\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-_b_c49sh\install-record.txt’ --single-version-externally-managed --compile Check the logs for full command output.

Hi,

please follow the instructions in the get started page: https://pytorch.org/get-started/locally/
From the binary you downloaded, you are trying to install the version 0.1.2 which is the first ever release of pytorch.

It still didn’t work.
I have followed the instructions given but still getting some errors.
I ran the command :
pip3 install torch==1.3.1+cu92 torchvision==0.4.2+cu92 -f https://download.pytorch.org/whl/torch_stable.html

Error i got:
Looking in links: https://download.pytorch.org/whl/torch_stable.html
ERROR: Could not find a version that satisfies the requirement torch==1.3.1+cu92 (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch==1.3.1+cu92

If you open the link, you’ll see that these versions are here.
Could you give more context on which machine do you install this? How did you get python?

It is Windows 64 bit
python 3.7.5 32 bit
no Anaconda environment

Ho,
I am not sure we actually build binaries for 32 bit python :confused:
cc @peterjc123

No, we don’t provide binaries for 32-bit Python because:

  1. On desktops and servers, the mainstream OS is 64-bit.
  2. x86 binaries doesn’t support CUDA and there is no AVX2 support.

But it should be fairly easy to build it yourself if really need that. BTW, Is there a particular reason that you need to use 32-bit Python on a x64 host system? I think it would be easier if you use x64 Python.

I install python 3.7 64 bit and now it works :heart_eyes: THANK YOU GUYS :+1:

2 Likes

Hi!
I am facing same issue i have python 3.6.8 64 no anaconda environment i am using Bash app. I have checked above link and run command but again i got errors

@peterjc123 hi all and Peter…

my PC is quite old, from 2010. I have:

  • 32bit win7
  • python3.6.5
  • no conda

is there still chance to install torch? I m facing same

tools.nnwrap

issue…

There is no easy way to do this. You’ll have to build from source.

Hello shymal ,
I m tired with this issue too.
can you tell me which pip command you used after install python x64