安装torch失败 2020-12-05

错误:


PS D:\Bringing-Old-Photos-Back-to-Life-master> pip install torch -i https://pypi.douban.com/simple

Looking in indexes: https://pypi.douban.com/simple

Collecting torch

  Downloading https://pypi.doubanio.com/packages/f8/02/880b468bd382dc79896eaecbeb8ce95e9c4b99a24902874a2cef0b562cea/torch-0.1.2.post2.tar.gz (128 kB)

    |████████████████████████████████| 128 kB 6.8 MB/s

Requirement already satisfied: pyyaml in d:\python\python38\lib\site-packages (from torch) (5.3.1)

Building wheels for collected packages: torch

  Building wheel for torch (setup.py) ... error

  ERROR: Command errored out with exit status 1:

  command: 'd:\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\wgy\\AppData\\Local\\Temp\\pip-install-ka8hl0kf\\torch_aa4d618336794de9ac94591e9e350e71\\setup.py'"'"'; __file__='"'"'C:\\Users\\wgy\\AppData\\Local\\Temp\\pip-install-ka8hl0kf\\torch_aa4d618336794de9ac94591e9e350e71\\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\wgy\AppData\Local\Temp\pip-wheel-0fq1ocxu'

      cwd: C:\Users\wgy\AppData\Local\Temp\pip-install-ka8hl0kf\torch_aa4d618336794de9ac94591e9e350e71\

  Complete output (30 lines):

  running bdist_wheel

  running build

  running build_deps

  Traceback (most recent call last):

    File "", line 1, in <module>

    File "C:\Users\wgy\AppData\Local\Temp\pip-install-ka8hl0kf\torch_aa4d618336794de9ac94591e9e350e71\setup.py", line 225, in <module>

      setup(name="torch", version="0.1.2.post2",

    File "d:\python\python38\lib\site-packages\setuptools\__init__.py", line 145, in setup

      return distutils.core.setup(**attrs)

    File "d:\python\python38\lib\distutils\core.py", line 148, in setup

      dist.run_commands()

    File "d:\python\python38\lib\distutils\dist.py", line 966, in run_commands

      self.run_command(cmd)

    File "d:\python\python38\lib\distutils\dist.py", line 985, in run_command

      cmd_obj.run()

    File "d:\python\python38\lib\site-packages\wheel\bdist_wheel.py", line 299, in run

      self.run_command('build')

    File "d:\python\python38\lib\distutils\cmd.py", line 313, in run_command

      self.distribution.run_command(command)

    File "d:\python\python38\lib\distutils\dist.py", line 985, in run_command

      cmd_obj.run()

    File "d:\python\python38\lib\distutils\command\build.py", line 135, in run

      self.run_command(cmd_name)

    File "d:\python\python38\lib\distutils\cmd.py", line 313, in run_command

      self.distribution.run_command(command)

    File "d:\python\python38\lib\distutils\dist.py", line 985, in run_command

      cmd_obj.run()

    File "C:\Users\wgy\AppData\Local\Temp\pip-install-ka8hl0kf\torch_aa4d618336794de9ac94591e9e350e71\setup.py", line 51, in run

      from tools.nnwrap import generate_wrappers as generate_nn_wrappers

  ModuleNotFoundError: No module named 'tools.nnwrap'

  ----------------------------------------

  ERROR: Failed building wheel for torch

  Running setup.py clean for torch

  ERROR: Command errored out with exit status 1:

  command: 'd:\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\wgy\\AppData\\Local\\Temp\\pip-install-ka8hl0kf\\torch_aa4d618336794de9ac94591e9e350e71\\setup.py'"'"'; __file__='"'"'C:\\Users\\wgy\\AppData\\Local\\Temp\\pip-install-ka8hl0kf\\torch_aa4d618336794de9ac94591e9e350e71\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all

      cwd: C:\Users\wgy\AppData\Local\Temp\pip-install-ka8hl0kf\torch_aa4d618336794de9ac94591e9e350e71

  Complete output (2 lines):

  running clean

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

  ----------------------------------------

  ERROR: Failed cleaning build dir for torch

Failed to build torch

Installing collected packages: torch

    Running setup.py install for torch ... error

    ERROR: Command errored out with exit status 1:

    command: 'd:\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\wgy\\AppData\\Local\\Temp\\pip-install-ka8hl0kf\\torch_aa4d618336794de9ac94591e9e350e71\\setup.py'"'"'; __file__='"'"'C:\\Users\\wgy\\AppData\\Local\\Temp\\pip-install-ka8hl0kf\\torch_aa4d618336794de9ac94591e9e350e71\\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\wgy\AppData\Local\Temp\pip-record-c6ewbn0z\install-record.txt' --single-version-externally-managed --compile --install-headers 'd:\python\python38\Include\torch'

        cwd: C:\Users\wgy\AppData\Local\Temp\pip-install-ka8hl0kf\torch_aa4d618336794de9ac94591e9e350e71\

    Complete output (23 lines):

    running install

    running build_deps

    Traceback (most recent call last):

      File "", line 1, in <module>

      File "C:\Users\wgy\AppData\Local\Temp\pip-install-ka8hl0kf\torch_aa4d618336794de9ac94591e9e350e71\setup.py", line 225, in <module>

        setup(name="torch", version="0.1.2.post2",

      File "d:\python\python38\lib\site-packages\setuptools\__init__.py", line 145, in setup

        return distutils.core.setup(**attrs)

      File "d:\python\python38\lib\distutils\core.py", line 148, in setup

        dist.run_commands()

      File "d:\python\python38\lib\distutils\dist.py", line 966, in run_commands

        self.run_command(cmd)

      File "d:\python\python38\lib\distutils\dist.py", line 985, in run_command

        cmd_obj.run()

      File "C:\Users\wgy\AppData\Local\Temp\pip-install-ka8hl0kf\torch_aa4d618336794de9ac94591e9e350e71\setup.py", line 99, in run

        self.run_command('build_deps')

      File "d:\python\python38\lib\distutils\cmd.py", line 313, in run_command

        self.distribution.run_command(command)

      File "d:\python\python38\lib\distutils\dist.py", line 985, in run_command

        cmd_obj.run()

      File "C:\Users\wgy\AppData\Local\Temp\pip-install-ka8hl0kf\torch_aa4d618336794de9ac94591e9e350e71\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: 'd:\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\wgy\\AppData\\Local\\Temp\\pip-install-ka8hl0kf\\torch_aa4d618336794de9ac94591e9e350e71\\setup.py'"'"'; __file__='"'"'C:\\Users\\wgy\\AppData\\Local\\Temp\\pip-install-ka8hl0kf\\torch_aa4d618336794de9ac94591e9e350e71\\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\wgy\AppData\Local\Temp\pip-record-c6ewbn0z\install-record.txt' --single-version-externally-managed --compile --install-headers 'd:\python\python38\Include\torch' Check the logs for full command output.

https://download.pytorch.org/whl/torch_stable.html
下载对应的whl到本地后(注意GPU和CPU区分)

pip install ".\torch-1.7.0+cpu-cp38-cp38-win_amd64.whl" -i https://pypi.douban.com/simple

你可能感兴趣的:(安装torch失败 2020-12-05)