16
[INFO] Installing environment for https://github.com/pycqa/isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/builds/.../.cache/pre-commit/repo0_h0f938/py_env-python3.8/bin/python', '-mpip', 'install', '.')
return code: 1
expected return code: 0
[...]
stderr:
      ERROR: Command errored out with exit status 1:
[...]
        File "/tmp/pip-build-env-_3j1398p/overlay/lib/python3.8/site-packages/poetry/core/masonry/api.py", line 40, in prepare_metadata_for_build_wheel
          poetry = Factory().create_poetry(Path(".").resolve(), with_groups=False)
        File "/tmp/pip-build-env-_3j1398p/overlay/lib/python3.8/site-packages/poetry/core/factory.py", line 57, in create_poetry
          raise RuntimeError("The Poetry configuration is invalid:\n" + message)
      RuntimeError: The Poetry configuration is invalid:
        - [extras.pipfile_deprecated_finder.2] 'pip-shims<=0.3.4' does not match '^[a-zA-Z-_.0-9]+$'

I know I can upgrade the hook to isort-5.12.0 to fix the issue. However, our project are using python-3.7, isort-5.12.0 does not support it. Considering compatibility, we don't want to update python for now. What should I do?

LOTEAT
  • 181
  • 1
  • 4

2 Answers2

10

This is not a pre-commit issue but rather an Isort issue. Upgrade to the latest version of isort. It's now fixed:

https://github.com/PyCQA/isort/issues/2077 https://github.com/PyCQA/isort/pull/2078

mrswats
  • 155
  • 5
  • Yes, I have tried isort latest version. It does work. But it does not support python 3.7, we do not want to change the version of python. Is there any other way, such as specifying poetry version. – LOTEAT Jan 30 '23 at 09:00
  • Not much you can do, in that case. I would recommend upgrading to a newer version of python as it's gonna be EOL'd soon. – mrswats Jan 30 '23 at 10:49
  • @mrswats - Do you know by any chance why this issues occurred now? From all I can tell `isort 5.10.1` was working a few days ago... – Paul P Jan 30 '23 at 11:40
  • A minor release in poetry broke the build and they had to fix it in a rush. AND they seem to have dropped python 3.7 in the same release. – mrswats Jan 30 '23 at 12:54
8

You can fix this in python3.7 by using rev: 5.11.5 https://github.com/PyCQA/isort/issues/2083#issuecomment-1408300628

Tobias W.
  • 91
  • 2