ModuleNotFoundError: No module named 'tools.nnwrap'

爷,独闯天下 提交于 2019-12-17 22:44:47

问题


I am trying to import a package "torch". For same, I tried to install it using pip command as below, installation even started but after few seconds it got error

below is the command that I executed

pip install torch

Error that I got:

from tools.nnwrap import generate_wrappers as generate_nn_wrappers
    ModuleNotFoundError: No module named 'tools.nnwrap'

OS: Windows. IDE : pyCharm

I got the only link related to this issue but I was not able to interpret it.

https://www.gitmemory.com/torch


回答1:


For anyone who is looking for the issue.

It seems command to install torch not working as expected, you can try to get pytorch instead using below command. Its working and solved my above-mentioned issue.

Run below command:

# for OS: Windows, package: 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/




回答2:


For what it's worth, on Windows 10 in Anaconda, the only command which worked for me was:

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



回答3:


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



回答4:


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



回答5:


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).




回答6:


For me it was as simple as using python 3.7 to install torch. Also I've taken command from here - https://pytorch.org/get-started/locally/#anaconda.



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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!