Сбой установки библиотеки onnx на Windows 10 с использованием cmd - PullRequest
1 голос
/ 19 апреля 2020

Я пытаюсь установить onnx в cmd с помощью команды pip install onnx, но я получаю сообщение об ошибке, которое говорит, что у меня проблема в cmake .

Вывод ошибки:

ERROR: Command errored out with exit status 1:
>>command: 'c:\users\realm\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\realm\\AppData\\Local\\Temp\\pip-install-oxwi8385\\onnx\\setup.py'"'"'; __file__='"'"'C:\\Users\\realm\\AppData\\Local\\Temp\\pip-install-oxwi8385\\onnx\\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\realm\AppData\Local\Temp\pip-record-h01e7u49\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\realm\appdata\local\programs\python\python38-32\Include\onnx'
      cwd: C:\Users\realm\AppData\Local\Temp\pip-install-oxwi8385\onnx\

Complete output (82 lines):
running install
running build
running build_py
running create_version
running cmake_build
-- Building for: NMake Makefiles
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:17 (project):
  The CMAKE_C_COMPILER:

  cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:17 (project):
  The CMAKE_CXX_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


  >
-- Configuring incomplete, errors occurred!
See also "C:/Users/realm/AppData/Local/Temp/pip-install-oxwi8385/onnx/.setuptools-cmake-build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/realm/AppData/Local/Temp/pip-install-oxwi8385/onnx/.setuptools-cmake-build/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\realm\AppData\Local\Temp\pip-install-oxwi8385\onnx\setup.py", line 315, in <module>
    setuptools.setup(
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\install.py", line 61, in run
    return orig.install.run(self)
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\command\install.py", line 545, in run
    self.run_command('build')
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\command\build.py", line 135, in run
    self.run_command(cmd_name)
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\realm\AppData\Local\Temp\pip-install-oxwi8385\onnx\setup.py", line 209, in run
    self.run_command('cmake_build')
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\realm\AppData\Local\Temp\pip-install-oxwi8385\onnx\setup.py", line 195, in run
    subprocess.check_call(cmake_args)
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\\Users\\realm\\AppData\\Local\\Programs\\Python\\Python38-32\\Scripts\\cmake.exe', '-DPYTHON_INCLUDE_DIR=c:\\users\\realm\\appdata\\local\\programs\\python\\python38-32\\include', '-DPYTHON_EXECUTABLE=c:\\users\\realm\\appdata\\local\\programs\\python\\python38-32\\python.exe', '-DBUILD_ONNX_PYTHON=ON', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '-DONNX_NAMESPACE=onnx', '-DPY_EXT_SUFFIX=.cp38-win32.pyd', '-DCMAKE_BUILD_TYPE=Release', '-DPY_VERSION=3.8', '-DONNX_USE_MSVC_STATIC_RUNTIME=ON', '-DONNX_ML=1', 'C:\\Users\\realm\\AppData\\Local\\Temp\\pip-install-oxwi8385\\onnx']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 
>>'c:\users\realm\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\realm\\AppData\\Local\\Temp\\pip-install-oxwi8385\\onnx\\setup.py'"'"'; __file__='"'"'C:\\Users\\realm\\AppData\\Local\\Temp\\pip-install-oxwi8385\\onnx\\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\realm\AppData\Local\Temp\pip-record-h01e7u49\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\realm\appdata\local\programs\python\python38-32\Include\onnx' Check the logs for full command output.

1 Ответ

0 голосов
/ 19 апреля 2020

Я нашел решение, причиной была версия python, что я использую версию 3.8, но когда я изменил версию на 3.7, она работала, я не знаю точно, почему я обнаружил, что в onnx не было колеса 3.8, поэтому не поддерживается версией 3.8

...