Skip to content

Installation as pre-commit hooks fails. #10295

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

Closed
liebsc21 opened this issue Mar 20, 2025 · 8 comments
Closed

Installation as pre-commit hooks fails. #10295

liebsc21 opened this issue Mar 20, 2025 · 8 comments
Labels
Duplicate 🐫 Duplicate of an already existing issue
Milestone

Comments

@liebsc21
Copy link

When running pre-commit run --all-files --hook-stage manual pylint I get an setuptools.errors.InvalidConfigError: 'project.license-files' is defined already. Remove 'tool.setuptools.license-files'. error. See details below.

My .pre-commit-config.yaml contains

  - repo: https://github.com/pylint-dev/pylint
    rev: v3.3.4
    hooks:
      - id: pylint
        stages: [pre-push, manual]

I observe this error on Windows 10 with WinPython 3.10.9 or Ubuntu 24.04 with Python 3.10.16

This error occured only today. The setup was running successfully yesterday. I wonder how an update can affect this setup, since I pinned the pylint version and also setuptools remained the same version (65.5.0).

Details

[INFO] Installing environment for https://github.com/pylint-dev/pylint.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('<MY_HOME>\\.cache\\pre-commit\\repoabi1diw8\\py_env-default\\Scripts\\python.EXE', '-mpip', 'install', '.')
return code: 1
stdout:
    Processing <MY_HOME>\.cache\pre-commit\repoabi1diw8
      Installing build dependencies: started
      Installing build dependencies: finished with status 'done'
      Getting requirements to build wheel: started
      Getting requirements to build wheel: finished with status 'error'
stderr:
      error: subprocess-exited-with-error

      Getting requirements to build wheel did not run successfully.
      exit code: 1

      [43 lines of output]
      <MY_HOME>\AppData\Local\Temp\pip-build-env-971ri5wo\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py:82: SetuptoolsDeprecationWarning: `project.license` as a TOML table is deprecated
      !!

              ********************************************************************************
              Please use a simple string containing a SPDX expression for `project.license`. You can also use `project.license-files`.

              By 2026-Feb-18, you need to update your project and remove deprecated calls
              or your builds will no longer be supported.

              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************

      !!
        corresp(dist, value, root_dir)
      Traceback (most recent call last):
        File "<MY_HOME>\.cache\pre-commit\repoabi1diw8\py_env-default\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in <module>
          main()
        File "<MY_HOME>\.cache\pre-commit\repoabi1diw8\py_env-default\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
        File "<MY_HOME>\.cache\pre-commit\repoabi1diw8\py_env-default\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 143, in get_requires_for_build_wheel
          return hook(config_settings)
        File "<MY_HOME>\AppData\Local\Temp\pip-build-env-971ri5wo\overlay\Lib\site-packages\setuptools\build_meta.py", line 334, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
        File "<MY_HOME>\AppData\Local\Temp\pip-build-env-971ri5wo\overlay\Lib\site-packages\setuptools\build_meta.py", line 304, in _get_build_requires
          self.run_setup()
        File "<MY_HOME>\AppData\Local\Temp\pip-build-env-971ri5wo\overlay\Lib\site-packages\setuptools\build_meta.py", line 320, in run_setup
          exec(code, locals())
        File "<string>", line 1, in <module>
        File "<MY_HOME>\AppData\Local\Temp\pip-build-env-971ri5wo\overlay\Lib\site-packages\setuptools\__init__.py", line 117, in setup
          return distutils.core.setup(**attrs)
        File "<MY_HOME>\AppData\Local\Temp\pip-build-env-971ri5wo\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 160, in setup
          dist.parse_config_files()
        File "<MY_HOME>\.cache\pre-commit\repoabi1diw8\py_env-default\lib\site-packages\_virtualenv.py", line 22, in parse_config_files
          result = old_parse_config_files(self, *args, **kwargs)
        File "<MY_HOME>\AppData\Local\Temp\pip-build-env-971ri5wo\overlay\Lib\site-packages\setuptools\dist.py", line 748, in parse_config_files
          pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
        File "<MY_HOME>\AppData\Local\Temp\pip-build-env-971ri5wo\overlay\Lib\site-packages\setuptools\config\pyprojecttoml.py", line 73, in apply_configuration
          return _apply(dist, config, filepath)
        File "<MY_HOME>\AppData\Local\Temp\pip-build-env-971ri5wo\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py", line 55, in apply
          _apply_tool_table(dist, config, filename)
        File "<MY_HOME>\AppData\Local\Temp\pip-build-env-971ri5wo\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py", line 94, in _apply_tool_table
          raise InvalidConfigError(
      setuptools.errors.InvalidConfigError: 'project.license-files' is defined already. Remove 'tool.setuptools.license-files'.
      [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.
Check the log at <MY_HOME>\.cache\pre-commit\pre-commit.log
@MedRm
Copy link

MedRm commented Mar 20, 2025

Facing the same issue on pre-commit, on Ubuntu 24.04 with python 3.12

@Pierre-Sassoulas
Copy link
Member

This will be fixed in 3.3.6 once #10293 and #10294 are merged.

@Pierre-Sassoulas Pierre-Sassoulas added this to the 3.3.6 milestone Mar 20, 2025
@Pierre-Sassoulas Pierre-Sassoulas added the Duplicate 🐫 Duplicate of an already existing issue label Mar 20, 2025
@liebsc21
Copy link
Author

Thanks @Pierre-Sassoulas! But how can it be that my setup worked with pylint 3.3.4 one day and failed the other?

@Pierre-Sassoulas
Copy link
Member

Transitive dependancies changed (probably through setuptools)

@jeromehmu
Copy link

jeromehmu commented Mar 20, 2025

Is a way to prevent this in the future to set target a specific setuptools version. e.g. change

[build-system]
requires = [ "setuptools>=71.0.4" ]

to

[build-system]
requires = ["setuptools<=77.0.1"]

or does this make it more painful to keep updated with dependencies?
-edit- to target latest version of setuptools

@Pierre-Sassoulas
Copy link
Member

It should be a range not only <=, and the feasability depends on dependabot being able to upgrade it by pull requests (it would be nice if it's at the same time than the setuptool stubs too but still acceptable if there's 2 PR).

@jeromehmu
Copy link

you're right, probably should be "setuptools >=71.0.4, <=77.0.1" and yea, I'm not too familiar with dependabot's skill with handing that.

@Pierre-Sassoulas
Copy link
Member

Discussions around this topic came to the conclusion that doing nothing is the most efficient choice here pytest-dev/pytest-asyncio#1078 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate 🐫 Duplicate of an already existing issue
Projects
None yet
Development

No branches or pull requests

4 participants