Pip-tools: pip-compile broken with pip 19.2

Created on 23 Jul 2019  路  8Comments  路  Source: jazzband/pip-tools

pip 19.2 dropped the index_urls keyword argument from the PackageFinder

Environment Versions
  1. OS Type: Ubuntu 18.04
  2. Python version: Python 2.7.15+
  3. pip version: 19.2
  4. pip-tools version: pip-compile, version 3.9.0
Steps to replicate
python -m virtualenv demo
demo/bin/pip install -U pip pip-tools
echo pip-tools | demo/bin/pip-compile -o requirements.txt -
Expected result
#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile --find-links=/app/wheels/ --output-file=requirements.txt -
#
--find-links /app/wheels/

click==7.0                # via pip-tools
pip-tools==3.9.0
six==1.12.0               # via pip-tools
Actual result
Traceback (most recent call last):
  File "demo/bin/pip-compile", line 10, in <module>
    sys.exit(cli())
  File "/root/demo/local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/root/demo/local/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/root/demo/local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/root/demo/local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/root/demo/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/root/demo/local/lib/python2.7/site-packages/piptools/scripts/compile.py", line 256, in cli
    repository = PyPIRepository(pip_options, session, build_isolation)
  File "/root/demo/local/lib/python2.7/site-packages/piptools/repositories/pypi.py", line 95, in __init__
    self.finder = PackageFinder(**finder_kwargs)
TypeError: __init__() got an unexpected keyword argument 'index_urls'
bug

Most helpful comment

Hello @gvangool,

Thanks for the report! I'm working on fix.

All 8 comments

Hello @gvangool,

Thanks for the report! I'm working on fix.

A temporary workaround, of course, is to downgrade pip to a version less than 19.2, e.g.

pip install -U 'pip<19.2'

Watch out, python -m virtualenv ... seems to install the latest pip by default. If you run pip-compile via tox, you might not have a workaround until a new version of pip-tools is released.

You can workaround when using tox by adding:

setenv =
   VIRTUALENV_NO_DOWNLOAD=yes

to tox.ini and ensure you are using virtualenv<16.7.0 on your system (since virtualenv 16.7.0 ships with a copy of pip 19.2)

I get a slightly other exception when invoking pip-compile --extra-index-url https://foo.com/bar/dev/ --upgrade requirements.in

MacOS, Python 3.6.0, pip 19.2.1

Traceback (most recent call last):
  File "/foo/.pyenv/versions/qa-3.6.0/bin/pip-compile", line 10, in <module>
    sys.exit(cli())
  File "/foo/.pyenv/versions/3.6.0/envs/qa-3.6.0/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/foo/.pyenv/versions/3.6.0/envs/qa-3.6.0/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/foo/.pyenv/versions/3.6.0/envs/qa-3.6.0/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/foo/.pyenv/versions/3.6.0/envs/qa-3.6.0/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/foo/.pyenv/versions/3.6.0/envs/qa-3.6.0/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/foo/.pyenv/versions/3.6.0/envs/qa-3.6.0/lib/python3.6/site-packages/piptools/scripts/compile.py", line 256, in cli
    repository = PyPIRepository(pip_options, session, build_isolation)
  File "/foo/.pyenv/versions/3.6.0/envs/qa-3.6.0/lib/python3.6/site-packages/piptools/repositories/pypi.py", line 95, in __init__
    self.finder = PackageFinder(**finder_kwargs)
TypeError: __init__() got an unexpected keyword argument 'find_links'

Is this the same issue ?

@manuel-koch

Yes, it's the same. We are waiting for pip-tools==4.0.0 release approval. I'll leave this issue open until pip-tools released.

Having the same issue with Python 3.7.4/pip-tools==3.9.0/pip 19.2.1

(venv) [~/hacking/blog] (master) $ pip-compile
Traceback (most recent call last):
  File "/home/tom/hacking/blog/venv/bin/pip-compile", line 10, in <module>
    sys.exit(cli())
  File "/home/tom/hacking/blog/venv/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/tom/hacking/blog/venv/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/tom/hacking/blog/venv/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/tom/hacking/blog/venv/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/tom/hacking/blog/venv/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/tom/hacking/blog/venv/lib/python3.7/site-packages/piptools/scripts/compile.py", line 256, in cli
    repository = PyPIRepository(pip_options, session, build_isolation)
  File "/home/tom/hacking/blog/venv/lib/python3.7/site-packages/piptools/repositories/pypi.py", line 95, in __init__
    self.finder = PackageFinder(**finder_kwargs)
TypeError: __init__() got an unexpected keyword argument 'find_links'

pip-tools 4.0.0 release was approved and released to PyPI.
https://pypi.org/project/pip-tools/

Thanks @atugushev and @gvangool !

Was this page helpful?
0 / 5 - 0 ratings