Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError: No module named 'tools.nnwrap'

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

like image 980
Monu Avatar asked Jul 02 '19 20:07

Monu


3 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 https://download.pytorch.org/whl/cu90/torch-1.1.0-cp36-cp36m-win_amd64.whl
pip3 install https://download.pytorch.org/whl/cu90/torchvision-0.3.0-cp36-cp36m-win_amd64.whl

For another version/type of the software (OS, package, Language) installed, the command must be generated from the below-mentioned link.

https://pytorch.org/get-started/locally/

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.

like image 168
Monu Avatar answered Oct 19 '22 20:10

Monu


Follow the instructions on https://pytorch.org/get-started/locally/

Choose Package "Pip" if you want to pip install

It will give you output such as

pip3 install https://download.pytorch.org/whl/cu90/torch-1.1.0-cp37-cp37m-win_amd64.whl
pip3 install https://download.pytorch.org/whl/cu90/torchvision-0.3.0-cp37-cp37m-win_amd64.whl

Edit: new install instructions from pytorch.org shows commands such as

pip3 install torch===1.3.1 torchvision===0.4.2 -f https://download.pytorch.org/whl/torch_stable.html
like image 29
Slim Avatar answered Oct 19 '22 19:10

Slim


To 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 https://download.pytorch.org/whl/torch_stable.html
like image 15
Demotte Avatar answered Oct 19 '22 18:10

Demotte