Skip to content

Build error with the latest setuptool #4539

@justinchuby

Description

@justinchuby

Bug Report

Is the issue related to model conversion?

No

Describe the bug

Building from source with pip install -e . resulted in an error with the latest setuptool.

Running

 SETUPTOOLS_ENABLE_FEATURES="legacy-editable" pip install -e .

works.

System information

  • OS Platform and Distribution (e.g. Linux Ubuntu 16.04): Linux Ubuntu
  • ONNX version (e.g. 1.7): master
  • Python version: 3.10.7
  • GCC/Compiler version (if compiling from source):
  • CMake version:
  • Protobuf version:
  • Visual Studio version (if applicable):
Package                      Version   Editable project location
---------------------------- --------- -------------------------
absl-py                      1.2.0
astunparse                   1.6.3
cachetools                   5.2.0
certifi                      2022.9.14
charset-normalizer           2.1.1
contourpy                    1.0.5
cycler                       0.11.0
etils                        0.8.0
flatbuffers                  2.0.7
fonttools                    4.37.3
gast                         0.4.0
google-auth                  2.11.1
google-auth-oauthlib         0.4.6
google-pasta                 0.2.0
grpcio                       1.48.1
h5py                         3.7.0
idna                         3.4
importlib-resources          5.9.0
jax                          0.3.17
jaxlib                       0.3.15
joblib                       1.2.0
keras                        2.10.0
Keras-Preprocessing          1.1.2
kiwisolver                   1.4.4
libclang                     14.0.6
Markdown                     3.4.1
MarkupSafe                   2.1.1
matplotlib                   3.6.0
numpy                        1.23.3
oauthlib                     3.2.1
onnx                         1.12.0    /workspaces/onnx
opt-einsum                   3.3.0
packaging                    21.3
pandas                       1.5.0
Pillow                       9.2.0
pip                          22.2.2
plotly                       5.10.0
protobuf                     3.19.5
pyasn1                       0.4.8
pyasn1-modules               0.2.8
pyparsing                    3.0.9
python-dateutil              2.8.2
pytz                         2022.2.1
requests                     2.28.1
requests-oauthlib            1.3.1
rsa                          4.9
scikit-learn                 1.1.2
scipy                        1.9.1
seaborn                      0.12.0
setuptools                   65.3.0
six                          1.16.0
tenacity                     8.0.1
tensorboard                  2.10.0
tensorboard-data-server      0.6.1
tensorboard-plugin-wit       1.8.1
tensorflow                   2.10.0
tensorflow-estimator         2.10.0
tensorflow-io-gcs-filesystem 0.27.0
termcolor                    2.0.1
threadpoolctl                3.1.0
torch                        1.12.1
typing_extensions            4.3.0
urllib3                      1.26.12
Werkzeug                     2.2.2
wheel                        0.37.1
wrapt                        1.14.1
zipp                         3.8.1

Reproduction instructions

pip install -e .

Expected behavior

Notes

Building wheels for collected packages: onnx
  Building editable for onnx (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building editable for onnx (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [114 lines of output]
      running editable_wheel
      creating /tmp/pip-wheel-2mha55tp/tmpkm5xxdfk/onnx.egg-info
      writing /tmp/pip-wheel-2mha55tp/tmpkm5xxdfk/onnx.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-wheel-2mha55tp/tmpkm5xxdfk/onnx.egg-info/dependency_links.txt
      writing entry points to /tmp/pip-wheel-2mha55tp/tmpkm5xxdfk/onnx.egg-info/entry_points.txt
      writing requirements to /tmp/pip-wheel-2mha55tp/tmpkm5xxdfk/onnx.egg-info/requires.txt
      writing top-level names to /tmp/pip-wheel-2mha55tp/tmpkm5xxdfk/onnx.egg-info/top_level.txt
      writing manifest file '/tmp/pip-wheel-2mha55tp/tmpkm5xxdfk/onnx.egg-info/SOURCES.txt'
      reading manifest file '/tmp/pip-wheel-2mha55tp/tmpkm5xxdfk/onnx.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching '*.c' under directory 'onnx'
      adding license file 'LICENSE'
      writing manifest file '/tmp/pip-wheel-2mha55tp/tmpkm5xxdfk/onnx.egg-info/SOURCES.txt'
      creating '/tmp/pip-wheel-2mha55tp/tmpkm5xxdfk/onnx-1.12.0.dist-info'
      adding license file "LICENSE" (matched pattern "LICENSE")
      creating /tmp/pip-wheel-2mha55tp/tmpkm5xxdfk/onnx-1.12.0.dist-info/WHEEL
      /tmp/pip-build-env-5rbu00q6/overlay/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_py
      running create_version
      running cmake_build
      Extra cmake args: ['-DONNX_USE_PROTOBUF_SHARED_LIBS=ON']
      Using cmake args: ['/usr/bin/cmake', '-DPYTHON_INCLUDE_DIR=/usr/local/python/3.10.7/include/python3.10', '-DPYTHON_EXECUTABLE=/usr/local/python/3.10.7/bin/python3.10', '-DBUILD_ONNX_PYTHON=ON', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '-DONNX_NAMESPACE=onnx', '-DPY_EXT_SUFFIX=.cpython-310-x86_64-linux-gnu.so', '-DCMAKE_BUILD_TYPE=Release', '-DONNX_ML=1', '-DONNX_USE_PROTOBUF_SHARED_LIBS=ON', '/workspaces/onnx']
      Generated: /workspaces/onnx/.setuptools-cmake-build/onnx/onnx-ml.proto
      Generated: /workspaces/onnx/.setuptools-cmake-build/onnx/onnx-operators-ml.proto
      Generated: /workspaces/onnx/.setuptools-cmake-build/onnx/onnx-data.proto
      -- Could NOT find pybind11 (missing: pybind11_DIR)
      -- pybind11 v2.9.1
      --
      -- ******** Summary ********
      --   CMake version             : 3.16.3
      --   CMake command             : /usr/bin/cmake
      --   System                    : Linux
      --   C++ compiler              : /usr/bin/c++
      --   C++ compiler version      : 9.4.0
      --   CXX flags                 :  -Wnon-virtual-dtor
      --   Build type                : Release
      --   Compile definitions       : __STDC_FORMAT_MACROS
      --   CMAKE_PREFIX_PATH         :
      --   CMAKE_INSTALL_PREFIX      : /usr/local
      --   CMAKE_MODULE_PATH         :
      --
      --   ONNX version              : 1.12.0
      --   ONNX NAMESPACE            : onnx
      --   ONNX_USE_LITE_PROTO       : OFF
      --   USE_PROTOBUF_SHARED_LIBS  : ON
      --   Protobuf_USE_STATIC_LIBS  : OFF
      --   ONNX_DISABLE_EXCEPTIONS   : OFF
      --   ONNX_WERROR               : OFF
      --   ONNX_BUILD_TESTS          : OFF
      --   ONNX_BUILD_BENCHMARKS     : OFF
      --
      --   Protobuf compiler         : /usr/bin/protoc
      --   Protobuf includes         : /usr/include
      --   Protobuf libraries        : /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread
      --   BUILD_ONNX_PYTHON         : ON
      --     Python version        :
      --     Python executable     : /usr/local/python/3.10.7/bin/python3.10
      --     Python includes       : /usr/local/python/3.10.7/include/python3.10
      -- Configuring done
      -- Generating done
      -- Build files have been written to: /workspaces/onnx/.setuptools-cmake-build
      [  3%] Built target gen_onnx_proto
      [  6%] Built target gen_onnx_data_proto
      [  9%] Built target gen_onnx_operators_proto
      [ 24%] Built target onnx_proto
      [ 96%] Built target onnx
      [100%] Built target onnx_cpp2py_export
      running build_ext
      copying /workspaces/onnx/.setuptools-cmake-build/onnx_cpp2py_export.cpython-310-x86_64-linux-gnu.so -> /tmp/tmpksx5ht08.build-lib/onnx
      Traceback (most recent call last):
        File "/tmp/pip-build-env-5rbu00q6/overlay/lib/python3.10/site-packages/setuptools/_distutils/file_util.py", line 40, in _copy_file_contents
          fdst = open(dst, 'wb')
      FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpksx5ht08.build-lib/onnx/onnx_cpp2py_export.cpython-310-x86_64-linux-gnu.so'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/tmp/pip-build-env-5rbu00q6/overlay/lib/python3.10/site-packages/setuptools/command/editable_wheel.py", line 140, in run
          self._create_wheel_file(bdist_wheel)
        File "/tmp/pip-build-env-5rbu00q6/overlay/lib/python3.10/site-packages/setuptools/command/editable_wheel.py", line 330, in _create_wheel_file
          files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
        File "/tmp/pip-build-env-5rbu00q6/overlay/lib/python3.10/site-packages/setuptools/command/editable_wheel.py", line 261, in _run_build_commands
          self._run_build_subcommands()
        File "/tmp/pip-build-env-5rbu00q6/overlay/lib/python3.10/site-packages/setuptools/command/editable_wheel.py", line 288, in _run_build_subcommands
          self.run_command(name)
        File "/tmp/pip-build-env-5rbu00q6/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-5rbu00q6/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-5rbu00q6/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
          cmd_obj.run()
        File "<string>", line 255, in run
        File "/tmp/pip-build-env-5rbu00q6/overlay/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/tmp/pip-build-env-5rbu00q6/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
          self.build_extensions()
        File "<string>", line 272, in build_extensions
        File "/tmp/pip-build-env-5rbu00q6/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 351, in copy_file
          return file_util.copy_file(
        File "/tmp/pip-build-env-5rbu00q6/overlay/lib/python3.10/site-packages/setuptools/_distutils/file_util.py", line 163, in copy_file
          _copy_file_contents(src, dst)
        File "/tmp/pip-build-env-5rbu00q6/overlay/lib/python3.10/site-packages/setuptools/_distutils/file_util.py", line 42, in _copy_file_contents
          raise DistutilsFileError(
      distutils.errors.DistutilsFileError: could not create '/tmp/tmpksx5ht08.build-lib/onnx/onnx_cpp2py_export.cpython-310-x86_64-linux-gnu.so': No such file or directory
      error: Support for editable installs via PEP 660 was recently introduced
      in `setuptools`. If you are seeing this error, please report to:
      
      https://github.com/pypa/setuptools/issues
      
      Meanwhile you can try the legacy behavior by setting an
      environment variable and trying to install again:
      
      SETUPTOOLS_ENABLE_FEATURES="legacy-editable"
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building editable for onnx
Failed to build onnx
ERROR: Could not build wheels for onnx, which is required to install pyproject.toml-based projects

Metadata

Metadata

Assignees

Labels

bugtopic: buildIssues related to ONNX builds and packages

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions