onnx / optimizer

Actively maintained ONNX Optimizer
Apache License 2.0
650 stars 90 forks source link

`onnxoptimizer` is missing support for python 3.10 #97

Closed bcm-at-zama closed 1 year ago

bcm-at-zama commented 2 years ago

Summary

It looks onnxoptimizer is missing support for python 3.10. Notably, I don't see 3.10 files in https://pypi.org/project/onnxoptimizer/#files

Details

On my Mac:

% python3.10 -m venv .venv % source .venv/bin/activate % python3.10 --version Python 3.10.6

% python3.10 -m pip install onnxoptimizer

Collecting onnxoptimizer
  Using cached onnxoptimizer-0.3.1.tar.gz (17.4 MB)
  Preparing metadata (setup.py) ... done
Collecting onnx
  Downloading onnx-1.12.0-cp310-cp310-macosx_10_12_x86_64.whl (12.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.4/12.4 MB 32.2 MB/s eta 0:00:00
Collecting typing-extensions>=3.6.2.1
  Using cached typing_extensions-4.3.0-py3-none-any.whl (25 kB)
Collecting protobuf<=3.20.1,>=3.12.2
  Downloading protobuf-3.20.1-cp310-cp310-macosx_10_9_universal2.whl (962 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 962.3/962.3 kB 20.2 MB/s eta 0:00:00
Collecting numpy>=1.16.6
  Using cached numpy-1.23.2-cp310-cp310-macosx_10_9_x86_64.whl (18.1 MB)
Using legacy 'setup.py install' for onnxoptimizer, since package 'wheel' is not installed.
Installing collected packages: typing-extensions, protobuf, numpy, onnx, onnxoptimizer
  Running setup.py install for onnxoptimizer ... error
  error: subprocess-exited-with-error

  × Running setup.py install for onnxoptimizer did not run successfully.
  │ exit code: 1
  ╰─> [70 lines of output]
      fatal: not a git repository (or any of the parent directories): .git
     [REDACTED]/.venv/lib/python3.10/site-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
        warnings.warn(
      [REDACTED]/.venv/lib/python3.10/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
        warnings.warn(msg, warning_class)
      [REDACTED]/.venv/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
        warnings.warn(
      WARNING: The wheel package is not available.
      running install
      [REDACTED].venv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      running create_version
      running cmake_build
      CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
        CMake 3.22 or higher is required.  You are running version 3.18.2

      -- Configuring incomplete, errors occurred!
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/zf/w2q9lrs922d1d515bg7hkqmw0000gn/T/pip-install-g2drcre2/onnxoptimizer_db0e761224f949edbbec832c6f400ae5/setup.py", line 320, in <module>
          setuptools.setup(
        File "[REDACTED].venv/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 973, in run_commands
          self.run_command(cmd)
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
          cmd_obj.run()
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/command/install.py", line 68, in run
          return orig.install.run(self)
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install.py", line 698, in run
          self.run_command('build')
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
          cmd_obj.run()
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/command/build.py", line 24, in run
          super().run()
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 132, in run
          self.run_command(cmd_name)
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
          cmd_obj.run()
        File "/private/var/folders/zf/w2q9lrs922d1d515bg7hkqmw0000gn/T/pip-install-g2drcre2/onnxoptimizer_db0e761224f949edbbec832c6f400ae5/setup.py", line 216, in run
          self.run_command('cmake_build')
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "[REDACTED]/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
          cmd_obj.run()
        File "/private/var/folders/zf/w2q9lrs922d1d515bg7hkqmw0000gn/T/pip-install-g2drcre2/onnxoptimizer_db0e761224f949edbbec832c6f400ae5/setup.py", line 202, in run
          subprocess.check_call(cmake_args)
        File "/usr/local/Cellar/python@3.10/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/usr/local/bin/cmake', '-DPython_INCLUDE_DIR=/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10', '-DPython_EXECUTABLE=[REDACTED]/.venv/bin/python3.10', '-DBUILD_ONNX_PYTHON=ON', '-DONNX_USE_LITE_PROTO=ON', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '-DONNX_NAMESPACE=onnx', '-DPY_EXT_SUFFIX=.cpython-310-darwin.so', '-DONNX_OPT_USE_SYSTEM_PROTOBUF=OFF', '-DCMAKE_BUILD_TYPE=Release', '-DONNX_ML=1', '/private/var/folders/zf/w2q9lrs922d1d515bg7hkqmw0000gn/T/pip-install-g2drcre2/onnxoptimizer_db0e761224f949edbbec832c6f400ae5']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> onnxoptimizer

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
bcm-at-zama commented 2 years ago

ProductName: macOS ProductVersion: 11.6.7 BuildVersion: 20G630

xin-li-67 commented 2 years ago

Emm, I came across this similar issue on my m1 mac as well. I'm using python 3.8 with pytorch 1.12.1.

yan12125 commented 2 years ago

Seems onnxoptimizer is built for cp3?-* [1], so cp310-* (CPython 3.10) and cp311-* (CPython 3.11) do not match.

[1] https://github.com/onnx/optimizer/blob/74fdf9cbbf9f7e70fc9727871ba63a8472e26dee/.github/workflows/build-and-test.yml#L20

yan12125 commented 1 year ago

0.3.6 is published with Python 3.10 and 3.11 wheels 🎉

https://pypi.org/project/onnxoptimizer/#files

daquexian commented 1 year ago

@yan12125 Yes :) Sorry for not keeping you updated.

I'm closing this issue. Please feel free to reopen it if you have any further problems.