pip-tools: Error importing BAR_TYPES with new pip 22.1 release

pip-tools breaks with the new version of pip “22.1”. Error:

ImportError: cannot import name 'BAR_TYPES' from 'pip._internal.cli.progress_bars' (/tmp/tmpxfal9pqx/6297f3abdc8a9aff/test-env/lib/python3.9/site-packages/pip/_internal/cli/progress_bars.py)

Environment Versions

OS: Ubuntu 20.04 Python version: 3.9 pip version: 22.1 pip-tools version: 6.6.0

Steps to replicate

  1. pip install -U pip pip-tools
  2. pip-compile requirements.in

Expected result

Compilation is successful

Actual result

Full traceback from my CI job.

Traceback (most recent call last):
  File "/tmp/tmpxfal9pqx/6297f3abdc8a9aff/test-env/bin/pip-compile", line 5, in <module>
    from piptools.scripts.compile import cli
  File "/tmp/tmpxfal9pqx/6297f3abdc8a9aff/test-env/lib/python3.9/site-packages/piptools/scripts/compile.py", line 21, in <module>
    from ..repositories import LocalRequirementsRepository, PyPIRepository
  File "/tmp/tmpxfal9pqx/6297f3abdc8a9aff/test-env/lib/python3.9/site-packages/piptools/repositories/__init__.py", line 1, in <module>
    from .local import LocalRequirementsRepository
  File "/tmp/tmpxfal9pqx/6297f3abdc8a9aff/test-env/lib/python3.9/site-packages/piptools/repositories/local.py", line 14, in <module>
    from .pypi import PyPIRepository
  File "/tmp/tmpxfal9pqx/6297f3abdc8a9aff/test-env/lib/python3.9/site-packages/piptools/repositories/pypi.py", line 23, in <module>
    from pip._internal.cli.progress_bars import BAR_TYPES
ImportError: cannot import name 'BAR_TYPES' from 'pip._internal.cli.progress_bars' (/tmp/tmpxfal9pqx/6297f3abdc8a9aff/test-env/lib/python3.9/site-packages/pip/_internal/cli/progress_bars.py)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 93
  • Comments: 20 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Fix released as part of pip-tools v6.6.1.

For me it worked after doing:

  1. pip install pip==22.0.4
  2. pip install --upgrade pip-tools

Thanks to @lafolle for pointing the latest working version.

I’m a bit puzzled why pip and pip-tools are not kept within the same project.

pip-tools is instrumental to using pip since pip-compiles enables devs to separate direct dependencies from indirect ones. Also, it is great for fixing versions. (it makes the pip system work just like packages.json and npm…)

For now i am just pinning pip to 22.0.4. Looking forward to the fix!

That commit has been in the pip main branch for a month. ideally, this repo should be testing against that regularly to catch for this kind of thing early, rather than needing to add a version cap that would just get in the way later.

oh dear, it does regularly check for this: https://github.com/jazzband/pip-tools/runs/6267937837?check_suite_focus=true

edit: oh yeah, here’s where the relevant discussion continues, back through this wormhole to January: https://github.com/jazzband/pip-tools/issues/1558#issuecomment-1026462006

IIRC this isn’t the first time a new pip release has broken pip-tools. Would it be a good idea to have upper bounds in its dependency?

I’m a bit puzzled why pip and pip-tools are not kept within the same project.

This also came up the last quarter, so I’ll repeat https://github.com/jazzband/pip-tools/issues/1558#issuecomment-1026655582:

I’m not sure whether a change in organisation would necessarily help, the pip team will continue to change their private internal functions as they need to (and there will be more changes to use Rich more for better output).

Also, the pip team are very busy working on pip and we can’t expect them to maintain pip-tools as well.

In fact, moving pip-tools out of Jazzband would be a backwards step: it would mean that fewer people are able to maintain it.


As noted by @wizpig64 above, pip-tools does indeed have a daily cron regularly testing against pip’s main branch, in fact it did catch the change in pip (but remember: pip has no official API) and started failing a month ago.

This also happened last quarter, so I’ll also repeat https://github.com/jazzband/pip-tools/issues/1558#issuecomment-1026655582:

Wherever it lives, I’d suggest a closer eye is paid to the integration of pip with pip-tools, especially in the lead up to pip’s quarterly releases. (And look out for the pip release issues for planned release dates e.g. https://github.com/pypa/pip/issues/10726.)

Pulling that out into a more immediate release seems reasonable to me. 😃

  1. pip is not following semantic versioning
  2. even if it did, removing a symbol from an internal module is not a breaking change

Please stop suggesting upper bounds pins, they would make everything much, much worse.

For me it worked after doing:

  1. pip install pip==22.0.4
  2. pip install --upgrade pip-tools

Thanks to @lafolle for pointing the latest working version.

That worked fine for me. Thanks =)

Thanks for getting this done so quickly 😃