ModuleNotFoundError: No module named ‘tools.nnwrap’ (windows)

南楼画角 提交于 2019-12-31 05:25:11

问题


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 “<string>”, line 1, in <module>

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.

Do anyone knows how to fix this error!!


回答1:


# 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/



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

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