I tried to install torch using:
pip install torch Installation started, but after a few seconds I got the error:
from tools.nnwrap import generate_wrappers as generate_nn_wrappers ModuleNotFoundError: No module named 'tools.nnwrap' OS: Windows
217 Answers
Anyone who is looking for the solution refer below:
It seems command to install torch not is working as expected, instead, you can try to install PyTorch using below command.
It's working and solved my above-mentioned issue.
Run below command(for below-specified OS, package-manager, Language):
# for OS: Windows, package-manager: pip, Language: python3.6 (below command is valid for only mentioned python 3.6) pip3 install pip3 install For another version/type of the software (OS, package, Language) installed, the command must be generated from the below-mentioned link.
Also, look for the Python version in your IDE(If you are using PyCharm) from the terminal using the command: python. If it returns 32bit this could happen, instead install Python 64-bit.
5Choose Package "Pip" if you want to pip install
It will give you output such as
pip3 install pip3 install Edit: new install instructions from pytorch.org shows commands such as
pip3 install torch===1.3.1 torchvision===0.4.2 -f 4To install stable version of pytorch in windows 10 for pycharm, following command should work.
pip install torch===1.4.0 torchvision===0.5.0 -f 0For what it's worth, on Windows 10 in Anaconda, the only command which worked for me was:
pip3 install 0This worked for Windows 10 using Python-3.x pip
pip install torch==1.4.0+cpu torchvision==0.5.0+cpu -f
For me this was fixed by checking my python version - I got this error with python 3.8, but the error went away when I downgraded to 3.7 (install instructions on the site only appear to go up to 3.7).
2How I fix it in Windows 10 (x64)
31 March 2020
Install CUDA from here:
- Version:
cuda_10.2.89_441.22_win10.exe
- Version:
Use official website pytorch:
- This command in CMD:
pip install torch===1.4.0 torchvision===0.5.0 -f
- This command in CMD:
In Anaconda3 I tried to use same website just change Package to conda:
I was getting the same error, then I found that the latest pytorch install requires CUDA 10.1, and once I installed that and the matching cuDNN, then this command line succeeded:
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch 1If you are using Anaconda (3.7) in windows then you need to install via .whl file. Download .whl file from here:- then put in the working directory and install it using pip.
For my system, I have renamed anaconda's pip to pip37
pip37 install torch-1.5.1+cpu-cp37-cp37m-win_amd64.whl pip37 install torchvision-0.6.1+cpu-cp37-cp37m-win_amd64.whl It will install Torch 1.5 & Torchvision 0.6.1 in your anaconda environment
Try this code. It worked for me-
pip install torch==1.4.0+cpu torchvision==0.5.0+cpu -f For me (Python 3.7.6 x64 on Windows 10) this line worked:
pip install torch==1.5.0 torchvision==0.6.0 -f To whoever that has problem with torch installation: I think instead of following any of the commands posted here, you better first check pytorch official website (). There you can easily specify all your setup info and get the proper command for download. ![]()
for the latest version of torch use the command below.
Without CUDA Support(CPU only):
pip install torch==1.7.0+cpu torchvision==0.8.1+cpu torchaudio===0.7.0 -f With CUDA Support:
pip install torch===1.7.0+cu110 torchvision===0.8.1+cu110 torchaudio===0.7.0 -f Check this link for the latest versions and get the command there itself from pytorch.
i got rid of this in next way: uninstall Python 32 bit and install 64bit.
Here you can find all versions
And here you can see pip/conda etc cmd commands to run to install torch
Had to fix this at two locations:
DEV windows 10 machine: CD to C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\Scripts execute: conda install pytorch
DEV Windows MSSQL Server Database Python Services CD to C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\PYTHON_SERVICES\Scripts execute: pip3 install torch
Try to uninstall python 3.8 32-bit and install 64-bit. it worked for me, then:
pip3 install numpy pip3 install --pre torch torchvision -f I got the same error and fixed it with:
pip install torch===1.7.0 torchvision===0.8.1 torchaudio===0.7.0 -f I'm on Windows 10, Python 3.8.6.
Alternatively:
- Go to
- Scroll down to the center of the page where you'll find a section with header "INSTALL PYTORCH"
- Select your preferences
- Copy the command to the right of where it says: "Run this Command:"
- Paste it on your termminal
- Click enter (I know, sounds obvious, but it wasn't for my old self when I first started)
