Skip to content
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

pre-commit: flake8 dependency conflict #7435

Closed
martin-kokos opened this issue Jan 30, 2023 · 8 comments
Closed

pre-commit: flake8 dependency conflict #7435

martin-kokos opened this issue Jan 30, 2023 · 8 comments
Labels
area/project Meta-issues for governance and the project itself

Comments

@martin-kokos
Copy link
Contributor

martin-kokos commented Jan 30, 2023

  • Poetry version: 1.4.0-dev0

  • Python version: python3.11

  • OS version and name: any

  • install pre-commit-hook

  • clear pre-commit cache rm -rf ~/.cache/pre-commit

  • run pre-commit run

Issue

Installing pre-commit environment fails with a dependency conflict. Flake8 is now at 6.0.0 but flake8-eradicate-1.4.0 requires <6

wemake-services/flake8-eradicate#269
A fix PR has been waiting for merge for a while.
wemake-services/flake8-eradicate#271

$ pre-commit run --all-files                                                                                                                                                                                                                                                                                                                                                                                                                              
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/pre-commit/pygrep-hooks.
[INFO] Initializing environment for https://github.com/asottile/yesqa.
[INFO] Initializing environment for https://github.com/asottile/yesqa:flake8-annotations==3.0.0,flake8-bugbear==23.1.20,flake8-comprehensions==3.10.1,flake8-eradicate==1.4.0,flake8-pie==0.16.0,flake8-quotes==3.3.2,flake8-simplify==0.19.3,flake8-tidy-imports==4.8.0,flake8-type-checking==2.3.0,flake8-typing-imports==1.14.0,flake8-use-fstring==1.4,pep8-naming==0.13.3.
[INFO] Initializing environment for https://github.com/asottile/pyupgrade.
[INFO] Initializing environment for https://github.com/hadialqattan/pycln.
[INFO] Initializing environment for https://github.com/pycqa/isort.
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://github.com/pycqa/flake8.
[INFO] Initializing environment for https://github.com/pycqa/flake8:flake8-annotations==3.0.0,flake8-bugbear==23.1.20,flake8-comprehensions==3.10.1,flake8-eradicate==1.4.0,flake8-pie==0.16.0,flake8-quotes==3.3.2,flake8-simplify==0.19.3,flake8-tidy-imports==4.8.0,flake8-type-checking==2.3.0,flake8-typing-imports==1.14.0,flake8-use-fstring==1.4,pep8-naming==0.13.3.
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit.
[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...
[INFO] Installing environment for https://github.com/asottile/yesqa.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/asottile/pyupgrade.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/hadialqattan/pycln.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pycqa/isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/psf/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pycqa/flake8.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/home/x/.cache/pre-commit/reponuvp7fdi/py_env-python3.11/bin/python', '-mpip', 'install', '.', 'flake8-annotations==3.0.0', 'flake8-bugbear==23.1.20', 'flake8-comprehensions==3.10.1', 'flake8-eradicate==1.4.0', 'flake8-pie==0.16.0', 'flake8-quotes==3.3.2', 'flake8-simplify==0.19.3', 'flake8-tidy-imports==4.8.0', 'flake8-type-checking==2.3.0', 'flake8-typing-imports==1.14.0', 'flake8-use-fstring==1.4', 'pep8-naming==0.13.3')
return code: 1
expected return code: 0
stdout:
    Processing /home/x/.cache/pre-commit/reponuvp7fdi
      Preparing metadata (setup.py): started
      Preparing metadata (setup.py): finished with status 'done'
    Collecting flake8-annotations==3.0.0
      Using cached flake8_annotations-3.0.0-py3-none-any.whl (16 kB)
    Collecting flake8-bugbear==23.1.20
      Using cached flake8_bugbear-23.1.20-py3-none-any.whl (26 kB)
    Collecting flake8-comprehensions==3.10.1
      Using cached flake8_comprehensions-3.10.1-py3-none-any.whl (7.3 kB)
    Collecting flake8-eradicate==1.4.0
      Using cached flake8_eradicate-1.4.0-py3-none-any.whl (5.2 kB)
    Collecting flake8-pie==0.16.0
      Using cached flake8_pie-0.16.0-py3-none-any.whl (49 kB)
    Collecting flake8-quotes==3.3.2
      Using cached flake8_quotes-3.3.2-py3-none-any.whl
    Collecting flake8-simplify==0.19.3
      Using cached flake8_simplify-0.19.3-py3-none-any.whl (26 kB)
    Collecting flake8-tidy-imports==4.8.0
      Using cached flake8_tidy_imports-4.8.0-py3-none-any.whl (10 kB)
    Collecting flake8-type-checking==2.3.0
      Using cached flake8_type_checking-2.3.0-py3-none-any.whl (20 kB)
    Collecting flake8-typing-imports==1.14.0
      Using cached flake8_typing_imports-1.14.0-py2.py3-none-any.whl (8.4 kB)
    Collecting flake8-use-fstring==1.4
      Using cached flake8_use_fstring-1.4-py3-none-any.whl
    Collecting pep8-naming==0.13.3
      Using cached pep8_naming-0.13.3-py3-none-any.whl (8.5 kB)
    Collecting attrs>=21.4
      Using cached attrs-22.2.0-py3-none-any.whl (60 kB)
    Collecting eradicate<3.0,>=2.0
      Using cached eradicate-2.1.0-py3-none-any.whl (6.9 kB)
    INFO: pip is looking at multiple versions of flake8-comprehensions to determine which version is compatible with other requirements. This could take a while.
    INFO: pip is looking at multiple versions of flake8-bugbear to determine which version is compatible with other requirements. This could take a while.
    INFO: pip is looking at multiple versions of <Python from Requires-Python> to determine which version is compatible with other requirements. This could take a while.
    INFO: pip is looking at multiple versions of flake8-annotations to determine which version is compatible with other requirements. This could take a while.

    The conflict is caused by:
        The user requested flake8 6.0.0 (from /home/x/.cache/pre-commit/reponuvp7fdi)
        flake8-annotations 3.0.0 depends on flake8>=5.0
        flake8-bugbear 23.1.20 depends on flake8>=3.0.0
        flake8-comprehensions 3.10.1 depends on flake8!=3.2.0 and >=3.0
        flake8-eradicate 1.4.0 depends on flake8<6 and >=3.5

    To fix this you could try to:
    1. loosen the range of package versions you've specified
    2. remove package versions to allow pip attempt to solve the dependency conflict


stderr:
    ERROR: Cannot install flake8 6.0.0 (from /home/x/.cache/pre-commit/reponuvp7fdi), flake8-annotations==3.0.0, flake8-bugbear==23.1.20, flake8-comprehensions==3.10.1 and flake8-eradicate==1.4.0 because these package versions have conflicting dependencies.
    ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

Check the log at /home/x/.cache/pre-commit/pre-commit.log
@martin-kokos martin-kokos added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jan 30, 2023
@martin-kokos
Copy link
Contributor Author

martin-kokos commented Jan 30, 2023

At this moment, there is also another ongoing pre-commit issue PyCQA/isort#2083
pre-commit autoupdate fixes this

@martin-kokos martin-kokos changed the title pre-commit:flake8 dependency conflict pre-commit: flake8 dependency conflict Jan 30, 2023
@neersighted
Copy link
Member

This is not a Poetry issue, this is caused by the specified compatibility of the projects in question. Pre-commit and pip are installing the projects here, what makes you think Poetry is involved?

@martin-kokos
Copy link
Contributor Author

It might be upstream issue, but until flake8-eradicate bumps their flake8 dependency, installing pre-commit environment for poetry contributors is going to be broken.
Maybe holding flake8 on previous version 5.0.4 in .pre-commit-config.yaml for now, would be a fix.

@finswimmer
Copy link
Member

Maybe holding flake8 on previous version 5.0.4 in .pre-commit-config.yaml for now, would be a fix.

Hm, this already happens:

- repo: https://github.com/pycqa/flake8
# freeze to commit rev to prevent automatic updates, since newer versions of flake8 are not compatible with plugins
rev: 6027577d325b0dd8bf1e465ebd29b71b5f0d005b
hooks:
- id: flake8
additional_dependencies: *flake8_deps

@martin-kokos
Copy link
Contributor Author

Ah. So, isort is locked to broken 5.11.4, issue I linked in previous comment PyCQA/isort#2083 .
I did pre-commit autoupdate to resolve it and bump to isort 5.12.0. I missed I did this step, and that also bumped flake8 past the commit version to 6.0.0.
So I think isort needs to be bumped.

@neersighted neersighted added area/project Meta-issues for governance and the project itself and removed kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jan 30, 2023
@neersighted
Copy link
Member

Solved by bumping isort.

@dimbleby
Copy link
Contributor

isort was updated in 68770a6, this can be closed

(though the same presumably needs to happen in poetry-core and maybe others)

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/project Meta-issues for governance and the project itself
Projects
None yet
Development

No branches or pull requests

4 participants