解决pip install torch报错ModuleNotFoundError: No module named ‘tools.nnwrap‘

解决pip install torch报错

error: [Errno 2] No such file or directory: '.gitignore’

ModuleNotFoundError: No module named 'tools.nnwrap’

报错信息

Building wheels for collected packages: torch
  Running setup.py bdist_wheel for torch ... error
  Complete output from command c:\users\ainuc\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\AINUC\\AppData\\Local\\Temp\\pip-install-bj16kw3u\\torch\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\AINUC\AppData\Local\Temp\pip-wheel-3bamb7x2 --python-tag cp36:
  running bdist_wheel
  running build
  running build_deps
  Traceback (most recent call last):
    File "", line 1, in 
    File "C:\Users\AINUC\AppData\Local\Temp\pip-install-bj16kw3u\torch\setup.py", line 265, in 
      description="Tensors and Dynamic neural networks in Python with strong GPU acceleration",
    File "c:\users\ainuc\appdata\local\programs\python\python36\lib\site-packages\setuptools\__init__.py", line 129, in setup
      return distutils.core.setup(**attrs)
    File "c:\users\ainuc\appdata\local\programs\python\python36\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "c:\users\ainuc\appdata\local\programs\python\python36\lib\distutils\dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "c:\users\ainuc\appdata\local\programs\python\python36\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "C:\Users\AINUC\AppData\Roaming\Python\Python36\site-packages\wheel\bdist_wheel.py", line 290, in run
      self.run_command('build')
    File "c:\users\ainuc\appdata\local\programs\python\python36\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "c:\users\ainuc\appdata\local\programs\python\python36\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "c:\users\ainuc\appdata\local\programs\python\python36\lib\distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "c:\users\ainuc\appdata\local\programs\python\python36\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "c:\users\ainuc\appdata\local\programs\python\python36\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "C:\Users\AINUC\AppData\Local\Temp\pip-install-bj16kw3u\torch\setup.py", line 51, in run
      from tools.nnwrap import generate_wrappers as generate_nn_wrappers
  ModuleNotFoundError: No module named 'tools.nnwrap'

  ----------------------------------------
  Failed building wheel for torch
  Running setup.py clean for torch
  Complete output from command c:\users\ainuc\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\AINUC\\AppData\\Local\\Temp\\pip-install-bj16kw3u\\torch\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
  running clean
  error: [Errno 2] No such file or directory: '.gitignore'

  ----------------------------------------
  Failed cleaning build dir for torch
Failed to build torch
tensorboard 2.3.0 has requirement requests<3,>=2.21.0, but you'll have requests 2.18.4 which is incompatible.
tensorboard 2.3.0 has requirement setuptools>=41.0.0, but you'll have setuptools 39.0.1 which is incompatible.
mxnet 1.5.0 has requirement numpy<1.17.0,>=1.8.2, but you'll have numpy 1.19.2 which is incompatible.
google-auth 1.21.3 has requirement setuptools>=40.3.0, but you'll have setuptools 39.0.1 which is incompatible.
notebook 6.1.3 has requirement tornado>=5.0, but you'll have tornado 4.5.3 which is incompatible.
Installing collected packages: torch
  Running setup.py install for torch ... error
    Complete output from command c:\users\ainuc\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\AINUC\\AppData\\Local\\Temp\\pip-install-bj16kw3u\\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\AINUC\AppData\Local\Temp\pip-record-o93dm9_y\install-record.txt --single-version-externally-managed --compile:
    running install
    running build_deps
    Traceback (most recent call last):
      File "", line 1, in 
      File "C:\Users\AINUC\AppData\Local\Temp\pip-install-bj16kw3u\torch\setup.py", line 265, in 
        description="Tensors and Dynamic neural networks in Python with strong GPU acceleration",
      File "c:\users\ainuc\appdata\local\programs\python\python36\lib\site-packages\setuptools\__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "c:\users\ainuc\appdata\local\programs\python\python36\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "c:\users\ainuc\appdata\local\programs\python\python36\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "c:\users\ainuc\appdata\local\programs\python\python36\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Users\AINUC\AppData\Local\Temp\pip-install-bj16kw3u\torch\setup.py", line 99, in run
        self.run_command('build_deps')
      File "c:\users\ainuc\appdata\local\programs\python\python36\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\users\ainuc\appdata\local\programs\python\python36\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Users\AINUC\AppData\Local\Temp\pip-install-bj16kw3u\torch\setup.py", line 51, in run
        from tools.nnwrap import generate_wrappers as generate_nn_wrappers
    ModuleNotFoundError: No module named 'tools.nnwrap'

    ----------------------------------------
Command "c:\users\ainuc\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\AINUC\\AppData\\Local\\Temp\\pip-install-bj16kw3u\\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\AINUC\AppData\Local\Temp\pip-record-o93dm9_y\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\AINUC\AppData\Local\Temp\pip-install-bj16kw3u\torch\
You are using pip version 10.0.1, however version 20.2.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

解决办法

1.登录官网
https://pytorch.org/get-started/locally/
2.选择配置组合

解决pip install torch报错ModuleNotFoundError: No module named ‘tools.nnwrap‘_第1张图片

3.pip install

pip install torch==1.6.0+cpu torchvision==0.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html

欢迎大家交流学习,任何问题都可以留言

你可能感兴趣的:(日常报错,cv)