ModuleNotFoundError: No module named 'tools.nnwrap'

shyamal: <p>I am trying to install PyTorch but every time it throws the same error ( ModuleNotFoundError: No module named ‘tools.nnwrap’).<br>
This is what is typed: pip install torch</p>
<p>This is what I get every time:<br>
Collecting torch<br>
Using cached <a href="https://files.pythonhosted.org/packages/f8/02/880b468bd382dc79896eaecbeb8ce95e9c4b99a24902874a2cef0b562cea/torch-0.1.2.post2.tar.gz" rel="nofollow noopener">https://files.pythonhosted.org/packages/f8/02/880b468bd382dc79896eaecbeb8ce95e9c4b99a24902874a2cef0b562cea/torch-0.1.2.post2.tar.gz</a><br>
Requirement already satisfied: pyyaml in c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages (from torch) (5.1.2)<br>
Installing collected packages: torch<br>
Running setup.py install for torch … error<br>
ERROR: Command errored out with exit status 1:<br>
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’"’"’; <strong>file</strong>=’"’"‘C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(<strong>file</strong>);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, <strong>file</strong>, ‘"’"‘exec’"’"’))’ install --record ‘C:\Users\User\AppData\Local\Temp\pip-record-<em>b_c49sh\install-record.txt’ --single-version-externally-managed --compile<br>
cwd: C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch<br>
Complete output (23 lines):<br>
running install<br>
running build_deps<br>
Traceback (most recent call last):<br>
File “”, line 1, in <br>
File “C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py”, line 265, in <br>
description=“Tensors and Dynamic neural networks in Python with strong GPU acceleration”,<br>
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\setuptools_<em>init</em></em>.py", line 145, in setup<br>
return distutils.core.setup(**attrs)<br>
File “C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\distutils\core.py”, line 148, in setup<br>
dist.run_commands()<br>
File “C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\distutils\dist.py”, line 966, in run_commands<br>
self.run_command(cmd)<br>
File “C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\distutils\dist.py”, line 985, in run_command<br>
cmd_obj.run()<br>
File “C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py”, line 99, in run<br>
self.run_command(‘build_deps’)<br>
File “C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\distutils\cmd.py”, line 313, in run_command<br>
self.distribution.run_command(command)<br>
File “C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\distutils\dist.py”, line 985, in run_command<br>
cmd_obj.run()<br>
File “C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py”, line 51, in run<br>
from tools.nnwrap import generate_wrappers as generate_nn_wrappers<br>
ModuleNotFoundError: No module named ‘tools.nnwrap’<br>
----------------------------------------<br>
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’"’"’; <strong>file</strong>=’"’"‘C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(<strong>file</strong>);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, <strong>file</strong>, ‘"’"‘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.</p>

albanD: <p>Hi,</p>
<p>please follow the instructions in the get started page: <a href="https://pytorch.org/get-started/locally/">https://pytorch.org/get-started/locally/</a><br>
From the binary you downloaded, you are trying to install the version 0.1.2 which is the first ever release of pytorch.</p>

shyamal: <p>It still didn’t work.<br>
I have followed the instructions given but still getting some errors.<br>
I ran the command :<br>
pip3 install torch==1.3.1+cu92 torchvision==0.4.2+cu92 -f <a href="https://download.pytorch.org/whl/torch_stable.html" rel="nofollow noopener">https://download.pytorch.org/whl/torch_stable.html</a></p>
<p>Error i got:<br>
Looking in links: <a href="https://download.pytorch.org/whl/torch_stable.html" rel="nofollow noopener">https://download.pytorch.org/whl/torch_stable.html</a><br>
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)<br>
ERROR: No matching distribution found for torch==1.3.1+cu92</p>

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

shyamal: <p>It is Windows 64 bit<br>
python 3.7.5 32 bit<br>
no Anaconda environment</p>

albanD: <p>Ho,<br>
I am not sure we actually build binaries for 32 bit python <img src="https://discuss.pytorch.org/images/emoji/apple/confused.png?v=9" title=":confused:" class="emoji" alt=":confused:"><br>
cc <a class="mention" href="/u/peterjc123">@peterjc123</a></p>

peterjc123: <p>No, we don’t provide binaries for 32-bit Python because:</p>
<ol>
<li>On desktops and servers, the mainstream OS is 64-bit.</li>
<li>x86 binaries doesn’t support CUDA and there is no AVX2 support.</li>
</ol>
<p>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.</p>

shyamal: <p>I install python 3.7 64 bit and now it works  <img src="https://discuss.pytorch.org/images/emoji/apple/heart_eyes.png?v=9" title=":heart_eyes:" class="emoji" alt=":heart_eyes:"> THANK YOU GUYS <img src="https://discuss.pytorch.org/images/emoji/apple/+1.png?v=9" title=":+1:" class="emoji" alt=":+1:"></p>

Aqsa_Zahid: <p>Hi!<br>
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</p>

Hiva_Man: <p><a class="mention" href="/u/peterjc123">@peterjc123</a> hi all and Peter…</p>
<p>my PC is quite old, from 2010. I have:</p>
<ul>
<li>32bit win7</li>
<li>python3.6.5</li>
<li>no conda</li>
</ul>
<p>is there still chance to install torch? I m facing same</p>
<blockquote>
<p>tools.nnwrap</p>
</blockquote>
<p>issue…</p>

peterjc123: <p>There is no easy way to do this. You’ll have to build from source.</p>

Satyam_sharma: <p>Hello shymal ,<br>
I m tired with this issue too.<br>
can you tell me which pip command you used after install python x64</p>

harshrathod50: <p>I am so getting the same error:</p>
<pre><code class="lang-auto">[root@ip-172-26-11-98 ~]# python3.9 -m pip install torch==1.7.0+cpu torchvision==0.8.1+cpu torchaudio==0.7.0 -f https://download.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.7.0+cpu (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch==1.7.0+cpu
</code></pre>
<p>I’m on CentOS 7.8. What should I do now? Is there any lower version which can support?</p>

albanD: <p>Hi,</p>
<p>What is your operating system/python version? Having only this very old version available usually means that you’re running a 32bit python on windows (which we do not support, you should get a 64bit python).</p>

Tirth_Anand: <p>Hi,<br>
I have a 32 bit python on a 64 bit windows too. I want to install pytorch so that i can work on idle, even though i have it in anaconda. If I uninstall my 32 bit python and install a 64 bit python, will the libraries that i had individually installed using pip get uninstalled too?</p>

albanD: <p>Hi,</p>
<p>Yes you will need to re-install all libraries I’m afraid.<br>
You can use <code>pip freeze</code> to get the list of all installed libraries to be able to easily re-install them.</p>

Tirth_Anand: <p>I have installed a 64 bit python now, but its still showing the same error</p>

albanD: <p>You need to make sure that the python and pip you’re using properly point to the 64bit version.</p>

Tirth_Anand: <p>How do I do that? I am sorry that I dont know this stuff…</p>

Tirth_Anand: <p>After I installed the 64 bit python, I installed some other libraries such as numpy, pandas etc. and now I am able to use them on python. So that must mean my pip is pointing to the 64 bit python…shouldnt it?</p>