wjakob / nanobind

nanobind: tiny and efficient C++/Python bindings
BSD 3-Clause "New" or "Revised" License
2.14k stars 161 forks source link

[BUG]: failure to install nanobind from main due to a problem in pyproject.toml #566

Closed nurpax closed 1 month ago

nurpax commented 1 month ago

Problem description

Installing nanobind from github fails:

pip install git+https://github.com/wjakob/nanobind

->

Errors out:

Collecting git+https://github.com/wjakob/nanobind
  Cloning https://github.com/wjakob/nanobind to /tmp/pip-req-build-4ci4awmt
  Running command git clone --filter=blob:none --quiet https://github.com/wjakob/nanobind /tmp/pip-req-build-4ci4awmt
  Resolved https://github.com/wjakob/nanobind to commit ed5cfd5f4bfe93d1c2cc6bb0d72d4e7a63808548
  Running command git submodule update --init --recursive -q
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [59 lines of output]
      configuration error: `project.dynamic[4]` must be one of ['version', 'description', 'readme', 'requires-python', 'license', 'authors', 'maintainers', 'keywords', 'classifiers', 'urls', 'scripts', 'gui-scripts', 'entry-points', 'dependencies', 'optional-dependencies']
      GIVEN VALUE:
          "homepage"

      OFFENDING RULE: 'enum'

      DEFINITION:
          {
              "enum": [
                  "version",
                  "description",
                  "readme",
                  "requires-python",
                  "license",
                  "authors",
                  "maintainers",
                  "keywords",
                  "classifiers",
                  "urls",
                  "scripts",
                  "gui-scripts",
                  "entry-points",
                  "dependencies",
                  "optional-dependencies"
              ]
          }
      Traceback (most recent call last):
        File "/home/janne/dev/slimgui/.venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/janne/dev/slimgui/.venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/janne/dev/slimgui/.venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-6mybat4y/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-6mybat4y/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-6mybat4y/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 55, in <module>
        File "/tmp/pip-build-env-6mybat4y/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 104, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-6mybat4y/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 158, in setup
          dist.parse_config_files()
        File "/tmp/pip-build-env-6mybat4y/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 631, in parse_config_files
          pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
        File "/tmp/pip-build-env-6mybat4y/overlay/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 68, in apply_configuration
          config = read_configuration(filepath, True, ignore_option_errors, dist)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-6mybat4y/overlay/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 129, in read_configuration
          validate(subset, filepath)
        File "/tmp/pip-build-env-6mybat4y/overlay/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 57, in validate
          raise ValueError(f"{error}\n{summary}") from None
      ValueError: invalid pyproject.toml config: `project.dynamic[4]`.
      configuration error: `project.dynamic[4]` must be one of ['version', 'description', 'readme', 'requires-python', 'license', 'authors', 'maintainers', 'keywords', 'classifiers', 'urls', 'scripts', 'gui-scripts', 'entry-points', 'dependencies', 'optional-dependencies']
      [end of output]

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

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

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

If I try to install a version right before https://github.com/wjakob/nanobind/commit/ed5cfd5f4bfe93d1c2cc6bb0d72d4e7a63808548, pip install works fine:

pip install git+https://github.com/wjakob/nanobind@bcd936089989f11a0f76f28face7d8ca780ef137

Collecting git+https://github.com/wjakob/nanobind@bcd936089989f11a0f76f28face7d8ca780ef137
  Cloning https://github.com/wjakob/nanobind (to revision bcd936089989f11a0f76f28face7d8ca780ef137) to /tmp/pip-req-build-0bqth09j
  Running command git clone --filter=blob:none --quiet https://github.com/wjakob/nanobind /tmp/pip-req-build-0bqth09j
  Running command git rev-parse -q --verify 'sha^bcd936089989f11a0f76f28face7d8ca780ef137'
  Running command git fetch -q https://github.com/wjakob/nanobind bcd936089989f11a0f76f28face7d8ca780ef137
  Running command git checkout -q bcd936089989f11a0f76f28face7d8ca780ef137
  Resolved https://github.com/wjakob/nanobind to commit bcd936089989f11a0f76f28face7d8ca780ef137
  Running command git submodule update --init --recursive -q
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: nanobind
  Building wheel for nanobind (pyproject.toml) ... done
  Created wheel for nanobind: filename=nanobind-1.9.2-py3-none-any.whl size=215210 sha256=768b45fccc56cb20d4368b175a3f5c536a5acfa83b817b49df3ca6150b501a51
  Stored in directory: /home/janne/.cache/pip/wheels/1b/80/65/ba6b561371b7205ef5f702ac757409833f4f8ffea8fe857b44
Successfully built nanobind
Installing collected packages: nanobind
Successfully installed nanobind-1.9.2

Reproducible example code

I'm using Python 3.11.9 on Ubuntu 20.04.
wjakob commented 1 month ago

I reverted the last commit causing this issue.