Pip-tools: 6.0.0 has an undeclared dependency on importlib-metadata at python 3.6

Created on 14 Mar 2021  路  9Comments  路  Source: jazzband/pip-tools

pip-compile from pip-tools 6.0 doesn't work at python 3.6, throws an error about failing to find importlib.metadata

Environment Versions

pip-tools 6.0.0, python 3.6.8 are the important ones

Steps to replicate

[root@72c74788e4f9 /]# python3 -m venv /tmp/pip_tools

[root@72c74788e4f9 /]# source /tmp/pip_tools/bin/activate

(pip_tools) [root@72c74788e4f9 /]# python --version
Python 3.6.8

(pip_tools) [root@72c74788e4f9 /]# pip install pip-tools
Collecting pip-tools
  Downloading https://files.pythonhosted.org/packages/8d/81/15daf8485a9a508ee0fbbc3be328329a96efba8263863eeec331fd7972d9/pip_tools-6.0.0-py3-none-any.whl (43kB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 51kB 764kB/s
Collecting click>=7 (from pip-tools)
  Cache entry deserialization failed, entry ignored
  Cache entry deserialization failed, entry ignored
  Downloading https://files.pythonhosted.org/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/click-7.1.2-py2.py3-none-any.whl (82kB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 92kB 2.0MB/s
Collecting pip>=20.3 (from pip-tools)
  Cache entry deserialization failed, entry ignored
  Downloading https://files.pythonhosted.org/packages/fe/ef/60d7ba03b5c442309ef42e7d69959f73aacccd0d86008362a681c4698e83/pip-21.0.1-py3-none-any.whl (1.5MB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 1.5MB 879kB/s
Installing collected packages: click, pip, pip-tools
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed click-7.1.2 pip-21.0.1 pip-tools-6.0.0

(pip_tools) [root@72c74788e4f9 /]# pip-compile --help

Expected result

Usage: pip-compile [OPTIONS] [SRC_FILES]...

  Compiles requirements.txt from requirements.in specs.

...

Actual result


Traceback (most recent call last):
  File "/tmp/pip_tools/lib64/python3.6/site-packages/pip/_vendor/pep517/meta.py", line 10, in <module>
    import importlib.metadata as imp_meta
ModuleNotFoundError: No module named 'importlib.metadata'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/pip_tools/bin/pip-compile", line 7, in <module>
    from piptools.scripts.compile import cli
  File "/tmp/pip_tools/lib64/python3.6/site-packages/piptools/scripts/compile.py", line 12, in <module>
    from pip._vendor.pep517 import meta
  File "/tmp/pip_tools/lib64/python3.6/site-packages/pip/_vendor/pep517/meta.py", line 12, in <module>
    import importlib_metadata as imp_meta
ModuleNotFoundError: No module named 'importlib_metadata'
bug dependency

All 9 comments

I have the same issue on my 3.6 projects when they pip-compile.

But, if the import is coming from within pip, wouldn't this be pip's fault, for not depending on this properly when it vendored pep517?

edit: it looks like pep517 requires importlib_metadata for python<3.8

pip is not broken, and I expect that pip maintainers would say: if pip-tools chooses to rely on the internals of pip, then it is pip-tools problem to make that work.

(I don't know why pip-tools doesn't depend on pep517 directly, probably there's a good reason)

I see there was discussion on whether or not to use pip's private vendored copy of pep517 at https://github.com/jazzband/pip-tools/pull/1311#discussion_r567360260

FWIW I'm on team prefer-public-APIs, and I think this issue supports that. But, maintainer's choice!

Hello @dimbleby,

Thanks for the report! Huh, that was overlooked somehow. The fix is on the way.

I have the same issue, it breaks my 3.6 and 3.7 builds. The patch 6.0.1 is not on PyPI yet, guess I will have to roll back to the previous version for now?

FYI I'm attempting to get the 6.0.1 fix out right now, but the GH Actions seems to have a rather long queue time and having issues starting the job.
I'll keep you posted as soon as I get it through.

Thanks. My GH action is not deploying my library as well.. guess GH action is down at the moment? Don't worry, I am back to 5.5.0 at the moment but is happy to use the new version when it's back up again.

Screenshot 2021-03-15 at 21 44 20

There we go, pip-tools 6.0.1 is now released and available on PyPI! 馃帀

Amazing! Thanks @vphilippon

Was this page helpful?
0 / 5 - 0 ratings