pre-commit / pre-commit-hooks

Some out-of-the-box hooks for pre-commit
MIT License
5.2k stars 694 forks source link

fails to install on 3.12 #1052

Closed esc closed 4 months ago

esc commented 4 months ago
pre-commit run --verbose --all-files
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-mypy.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-mypy:types-pyyaml,types-filelock,types-setuptools.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/Users/esc/.cache/pre-commit/repocxtn2jxt/py_env-python3.12/bin/python', '-mpip', 'install', '.')
return code: 1
stdout:
    Processing /Users/esc/.cache/pre-commit/repocxtn2jxt
      Preparing metadata (setup.py): started
      Preparing metadata (setup.py): finished with status 'error'
stderr:
      error: subprocess-exited-with-error

      × python setup.py egg_info did not run successfully.
      │ exit code: 1
      ╰─> [11 lines of output]
          Traceback (most recent call last):
            File "<string>", line 2, in <module>
            File "<pip-setuptools-caller>", line 14, in <module>
            File "/Users/esc/.cache/pre-commit/repocxtn2jxt/py_env-python3.12/lib/python3.12/site-packages/setuptools/__init__.py", line 16, in <module>
              import setuptools.version
            File "/Users/esc/.cache/pre-commit/repocxtn2jxt/py_env-python3.12/lib/python3.12/site-packages/setuptools/version.py", line 1, in <module>
              import pkg_resources
            File "/Users/esc/.cache/pre-commit/repocxtn2jxt/py_env-python3.12/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2191, in <module>
              register_finder(pkgutil.ImpImporter, find_on_path)
                              ^^^^^^^^^^^^^^^^^^^
          AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
          [end of output]

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

    × Encountered error while generating package metadata.
    ╰─> See above for output.

    note: This is an issue with the package mentioned above, not pip.
    hint: See above for details.
Check the log at /Users/esc/.cache/pre-commit/pre-commit.log
esc commented 4 months ago

solution: https://github.com/pre-commit/pre-commit/issues/3041 -- upgrade virtualenv