Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation failed using python 3.10 pip (Windows) #4066

Closed
a7brusco opened this issue Mar 14, 2022 · 3 comments
Closed

Installation failed using python 3.10 pip (Windows) #4066

a7brusco opened this issue Mar 14, 2022 · 3 comments
Labels

Comments

@a7brusco
Copy link

Bug Report

Is the issue related to model conversion? No

Describe the bug

I wanted to install ONNX for my deep learning project following the installation guide. I'm using python 3.10.2 on windows and during my first try, I had an error requiring CMAKE. I installed CMAKE and retry to install ONNX but now I got this error :

Running setup.py install for onnx ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\antoine.brusco\Desktop\test\onnx\test_onnx\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\antoine.brusco\\AppData\\Local\\Temp\\pip-install-i0mprb7i\\onnx_ee9ef0e86d274b3c820191c5a07886d6\\setup.py'"'"'; __file__='"'"'C:\\Users\\antoine.brusco\\AppData\\Local\\Temp\\pip-install-i0mprb7i\\onnx_ee9ef0e86d274b3c820191c5a07886d6\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\antoine.brusco\AppData\Local\Temp\pip-record-wzn_a8_c\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\antoine.brusco\Desktop\test\onnx\test_onnx\include\site\python3.10\onnx'
         cwd: C:\Users\antoine.brusco\AppData\Local\Temp\pip-install-i0mprb7i\onnx_ee9ef0e86d274b3c820191c5a07886d6\
    Complete output (71 lines):
    fatal: not a git repository (or any of the parent directories): .git
    WARNING: The wheel package is not available.
    running install
    running build
    running build_py
    running create_version
    running cmake_build
    Using cmake args: ['C:\\CMake\\bin\\cmake.exe', '-DPYTHON_INCLUDE_DIR=C:\\Python310\\include', '-DPYTHON_EXECUTABLE=C:\\Users\\antoine.brusco\\Desktop\\test\\onnx\\test_onnx\\Scripts\\python.exe', '-DBUILD_ONNX_PYTHON=ON', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '-DONNX_NAMESPACE=onnx', '-DPY_EXT_SUFFIX=.cp310-win_amd64.pyd', '-DCMAKE_BUILD_TYPE=Release', '-DPY_VERSION=3.10', '-A', 'x64', '-T', 'host=x64', '-DONNX_ML=1', 'C:\\Users\\antoine.brusco\\AppData\\Local\\Temp\\pip-install-i0mprb7i\\onnx_ee9ef0e86d274b3c820191c5a07886d6']
    -- Building for: Visual Studio 16 2019
    -- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19044.
    -- The C compiler identification is MSVC 19.29.30038.1
    -- The CXX compiler identification is MSVC 19.29.30038.1
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found PythonInterp: C:/Users/antoine.brusco/Desktop/test/onnx/test_onnx/Scripts/python.exe (found suitable version "3.10.2", minimum required is "3.10")
    -- Found PythonLibs: C:/Python310/libs/python310.lib (found suitable version "3.10.2", minimum required is "3.10")
    CMake Error at C:/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
      Could NOT find Protobuf (missing: Protobuf_LIBRARIES Protobuf_INCLUDE_DIR)
    Call Stack (most recent call first):
      C:/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
      C:/CMake/share/cmake-3.22/Modules/FindProtobuf.cmake:650 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
      CMakeLists.txt:175 (find_package)


    -- Configuring incomplete, errors occurred!
    See also "C:/Users/antoine.brusco/AppData/Local/Temp/pip-install-i0mprb7i/onnx_ee9ef0e86d274b3c820191c5a07886d6/.setuptools-cmake-build/CMakeFiles/CMakeOutput.log".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\antoine.brusco\AppData\Local\Temp\pip-install-i0mprb7i\onnx_ee9ef0e86d274b3c820191c5a07886d6\setup.py", line 336, in <module>
        setuptools.setup(
      File "C:\Users\antoine.brusco\Desktop\test\onnx\test_onnx\lib\site-packages\setuptools\__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "C:\Python310\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Python310\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:\Python310\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\antoine.brusco\Desktop\test\onnx\test_onnx\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "C:\Python310\lib\distutils\command\install.py", line 568, in run
        self.run_command('build')
      File "C:\Python310\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Python310\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Python310\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "C:\Python310\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Python310\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\antoine.brusco\AppData\Local\Temp\pip-install-i0mprb7i\onnx_ee9ef0e86d274b3c820191c5a07886d6\setup.py", line 232, in run
        self.run_command('cmake_build')
      File "C:\Python310\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Python310\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\antoine.brusco\AppData\Local\Temp\pip-install-i0mprb7i\onnx_ee9ef0e86d274b3c820191c5a07886d6\setup.py", line 218, in run
        subprocess.check_call(cmake_args)
      File "C:\Python310\lib\subprocess.py", line 369, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['C:\\CMake\\bin\\cmake.exe', '-DPYTHON_INCLUDE_DIR=C:\\Python310\\include', '-DPYTHON_EXECUTABLE=C:\\Users\\antoine.brusco\\Desktop\\test\\onnx\\test_onnx\\Scripts\\python.exe', '-DBUILD_ONNX_PYTHON=ON', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '-DONNX_NAMESPACE=onnx', '-DPY_EXT_SUFFIX=.cp310-win_amd64.pyd', '-DCMAKE_BUILD_TYPE=Release', '-DPY_VERSION=3.10', '-A', 'x64', '-T', 'host=x64', '-DONNX_ML=1', 'C:\\Users\\antoine.brusco\\AppData\\Local\\Temp\\pip-install-i0mprb7i\\onnx_ee9ef0e86d274b3c820191c5a07886d6']' returned non-zero exit 
status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\antoine.brusco\Desktop\test\onnx\test_onnx\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\antoine.brusco\\AppData\\Local\\Temp\\pip-install-i0mprb7i\\onnx_ee9ef0e86d274b3c820191c5a07886d6\\setup.py'"'"'; __file__='"'"'C:\\Users\\antoine.brusco\\AppData\\Local\\Temp\\pip-install-i0mprb7i\\onnx_ee9ef0e86d274b3c820191c5a07886d6\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; 
setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\antoine.brusco\AppData\Local\Temp\pip-record-wzn_a8_c\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\antoine.brusco\Desktop\test\onnx\test_onnx\include\site\python3.10\onnx' Check the logs for full command output.

System information

  • OS Platform and Distribution (e.g. Linux Ubuntu 16.04): Windows 10 Entreprise 21H2
  • ONNX version (e.g. 1.7): 1.11.0
  • Python version: 3.10.2
  • GCC/Compiler version (if compiling from source): -
  • CMake version: 3.22.3
  • Protobuf version: 3.16.0
  • Visual Studio version (if applicable): -

Reproduction instructions

  • Installing CMAKE from website using windows x64 installer.
  • create a brand new python venv: python -m venv test_onnx
  • activate venv: test_onnx/Scripts/activate
  • installing ONNX requirements: pip install numpy protobuf==3.16.0
  • installing ONNX: pip install onnx

Expected behavior

Installing ONNX package

@a7brusco a7brusco added the bug label Mar 14, 2022
@jcwchen
Copy link
Member

jcwchen commented Mar 14, 2022

Hi @a7brusco,
There is no pre-built ONNX wheel for Python 3.10 yet: https://pypi.org/project/onnx/#files. So installing ONNX thru PyPI will install ONNX from source, which needs to build Protobuf from source. You can check the steps here to install Protobuf from source. Then installing ONNX from source should success.

Another option: onnx-weekly package from TestPyPI just had a Python 3.10 wheel last night: https://test.pypi.org/project/onnx-weekly/#files and you should be able to download it directly by pip install -i https://test.pypi.org/simple/ onnx-weekly. However, please note that it is a developing package from main branch instead of a stable released package.

@a7brusco
Copy link
Author

Ok, thanks for ansering, a last question : when a pre-build ONNX wheel for python 3.10 will be released ? (that may decide if I wait for it or not)

@jcwchen
Copy link
Member

jcwchen commented Mar 14, 2022

ONNX 1.11 has just been released last month so I would say next release will probably happen in 4 months or so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants