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

pip-sync broken with pip 8.1.2 #358

Closed
beedub opened this Issue May 11, 2016 · 17 comments

Comments

Projects
None yet
@beedub

beedub commented May 11, 2016

pip-sync doesn't work with pip==8.1.2

Steps to replicate
  1. Upgrade to pip 8.1.2
  2. Run pip-sync
Expected result
  • No error
  • Dependencies installed
Actual result

Error: AttributeError: 'Requirement' object has no attribute 'key'

@nhanb

This comment has been minimized.

Show comment
Hide comment
@nhanb

nhanb May 11, 2016

Same issue with pip-compile:

$ pip-compile --output-file requirements.txt requirements.in
Traceback (most recent call last):
  File "/home/vagrant/virtualenvs/myapp/bin/pip-compile", line 11, in <module>
    sys.exit(cli())
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/piptools/scripts/compile.py", line 164, in cli
    results = resolver.resolve()
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/piptools/resolver.py", line 78, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/piptools/resolver.py", line 147, in _resolve_one_round
    constraints = sorted(self.constraints, key=_dep_key)
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/piptools/resolver.py", line 49, in constraints
    self.their_constraints)))
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/piptools/resolver.py", line 118, in _group_constraints
    for _, ireqs in full_groupby(constraints, key=_dep_key):
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/piptools/utils.py", line 97, in full_groupby
    return groupby(sorted(iterable, key=key), key=key)
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/piptools/resolver.py", line 27, in _dep_key
    return ireq.req.key
AttributeError: 'Requirement' object has no attribute 'key'

I'm using:

  • pip-tools 1.6.4
  • pip 8.1.2
  • python 3.4.2

nhanb commented May 11, 2016

Same issue with pip-compile:

$ pip-compile --output-file requirements.txt requirements.in
Traceback (most recent call last):
  File "/home/vagrant/virtualenvs/myapp/bin/pip-compile", line 11, in <module>
    sys.exit(cli())
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/piptools/scripts/compile.py", line 164, in cli
    results = resolver.resolve()
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/piptools/resolver.py", line 78, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/piptools/resolver.py", line 147, in _resolve_one_round
    constraints = sorted(self.constraints, key=_dep_key)
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/piptools/resolver.py", line 49, in constraints
    self.their_constraints)))
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/piptools/resolver.py", line 118, in _group_constraints
    for _, ireqs in full_groupby(constraints, key=_dep_key):
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/piptools/utils.py", line 97, in full_groupby
    return groupby(sorted(iterable, key=key), key=key)
  File "/home/vagrant/virtualenvs/myapp/lib/python3.4/site-packages/piptools/resolver.py", line 27, in _dep_key
    return ireq.req.key
AttributeError: 'Requirement' object has no attribute 'key'

I'm using:

  • pip-tools 1.6.4
  • pip 8.1.2
  • python 3.4.2
@georgexsh

This comment has been minimized.

Show comment
Hide comment
@georgexsh

georgexsh May 11, 2016

with pip 8.1.2 under python 2.7.9 breaks too.

georgexsh commented May 11, 2016

with pip 8.1.2 under python 2.7.9 breaks too.

@sivabudh

This comment has been minimized.

Show comment
Hide comment
@sivabudh

sivabudh commented May 11, 2016

+1

@nvie

This comment has been minimized.

Show comment
Hide comment
@nvie

nvie May 11, 2016

Member

pip made some changes to its internal data structures in 8.1.2 it seems. I'm having a look to see if there's a quick fix for this or if it's more fundamental.

Member

nvie commented May 11, 2016

pip made some changes to its internal data structures in 8.1.2 it seems. I'm having a look to see if there's a quick fix for this or if it's more fundamental.

@nvie

This comment has been minimized.

Show comment
Hide comment
@nvie

nvie May 11, 2016

Member

Hmm, yeah these changes affect pip-tools at the core. We need to carefully inspect how these data structures were refactored and how we need to follow those new patterns. For now, I'll address this by issuing a warning that 8.1.2 is not supported in pip-tools 1.6.*, since I lack the time to properly fix this now.

I'll change the codebase to match 8.1.2, but it won't be a backward compatible fix, so I'll roll a new minor release for it when it's done.

This will be the situation:

  • pip-tools < 1.7 will only support pip < 8.1.2
  • pip-tools >= 1.7 will only support pip >= 8.1.2
Member

nvie commented May 11, 2016

Hmm, yeah these changes affect pip-tools at the core. We need to carefully inspect how these data structures were refactored and how we need to follow those new patterns. For now, I'll address this by issuing a warning that 8.1.2 is not supported in pip-tools 1.6.*, since I lack the time to properly fix this now.

I'll change the codebase to match 8.1.2, but it won't be a backward compatible fix, so I'll roll a new minor release for it when it's done.

This will be the situation:

  • pip-tools < 1.7 will only support pip < 8.1.2
  • pip-tools >= 1.7 will only support pip >= 8.1.2
@nvie

This comment has been minimized.

Show comment
Hide comment
@nvie

nvie May 11, 2016

Member

pip-tools==1.6.5 is now available which errors with a more helpful message than a random stack trace with internals.

Member

nvie commented May 11, 2016

pip-tools==1.6.5 is now available which errors with a more helpful message than a random stack trace with internals.

@cjerdonek

This comment has been minimized.

Show comment
Hide comment
@cjerdonek

cjerdonek May 11, 2016

@nvie Out of curiosity, have you considered articulating to the pip folks what needs to be part of their public API so that pip-tools can have forward compatibility?

cjerdonek commented May 11, 2016

@nvie Out of curiosity, have you considered articulating to the pip folks what needs to be part of their public API so that pip-tools can have forward compatibility?

@cjerdonek cjerdonek referenced this issue May 11, 2016

Closed

. #3673

@kiorky kiorky referenced this issue May 11, 2016

Closed

. #3676

@cjerdonek

This comment has been minimized.

Show comment
Hide comment
@cjerdonek

cjerdonek May 11, 2016

@kiorky Do you have a sense for whether the information needed by pip-tools and salt can sensibly be made available through pip's stable command-line API to prevent issues like this in the future? Or through some other stable interface?

cjerdonek commented May 11, 2016

@kiorky Do you have a sense for whether the information needed by pip-tools and salt can sensibly be made available through pip's stable command-line API to prevent issues like this in the future? Or through some other stable interface?

@voidus

This comment has been minimized.

Show comment
Hide comment
@voidus

voidus May 18, 2016

in pypa/pip#3573, it is suggested to use pypa/packaging directly, as pip is not meant to be used programmatically. Maybe that would be an option?
pypa/pip#3673 (comment)

voidus commented May 18, 2016

in pypa/pip#3573, it is suggested to use pypa/packaging directly, as pip is not meant to be used programmatically. Maybe that would be an option?
pypa/pip#3673 (comment)

@gjcooper

This comment has been minimized.

Show comment
Hide comment
@gjcooper

gjcooper Jun 19, 2016

I've come across this before, and downgrading pip has fixed it for me, but just updated to the latest version of Ubuntu and am getting the same error (AttributeError: 'Requirement' object has no attribute 'key') with versions:

Python 3.5.1+
pip-compile, version 1.6.5
pip 8.1.1

Within a pyvenv virtual environment. Possibly related to being on new python release.

gjcooper commented Jun 19, 2016

I've come across this before, and downgrading pip has fixed it for me, but just updated to the latest version of Ubuntu and am getting the same error (AttributeError: 'Requirement' object has no attribute 'key') with versions:

Python 3.5.1+
pip-compile, version 1.6.5
pip 8.1.1

Within a pyvenv virtual environment. Possibly related to being on new python release.

@jmbowman

This comment has been minimized.

Show comment
Hide comment
@jmbowman

jmbowman Jul 7, 2016

Contributor

@nvie Think it's safe to close this now, or giving it some time to hear feedback on the new release?

Contributor

jmbowman commented Jul 7, 2016

@nvie Think it's safe to close this now, or giving it some time to hear feedback on the new release?

@cjerdonek

This comment has been minimized.

Show comment
Hide comment
@cjerdonek

cjerdonek Jul 7, 2016

Worked for me. Thanks! 🎉

cjerdonek commented Jul 7, 2016

Worked for me. Thanks! 🎉

@nvie

This comment has been minimized.

Show comment
Hide comment
@nvie

nvie Jul 7, 2016

Member

Should be fixed in pip-tools==1.7, which was released yesterday!

Member

nvie commented Jul 7, 2016

Should be fixed in pip-tools==1.7, which was released yesterday!

@nvie nvie closed this Jul 7, 2016

@pdecat

This comment has been minimized.

Show comment
Hide comment
@pdecat

pdecat Jul 7, 2016

Works for me, thanks!

pdecat commented Jul 7, 2016

Works for me, thanks!

@aaugustin

This comment has been minimized.

Show comment
Hide comment
@aaugustin

aaugustin Jul 7, 2016

Works for me as well, thanks @jmbowman and @nvie!

aaugustin commented Jul 7, 2016

Works for me as well, thanks @jmbowman and @nvie!

@timmyomahony

This comment has been minimized.

Show comment
Hide comment
@timmyomahony

timmyomahony Sep 27, 2016

I'm not sure if I'm doing something wrong, but I'm still getting this error with pip==8.1.2 and pip-tools==1.6 (and python==3.5):

Traceback (most recent call last):
  File "/Users/user/Development/Sites/myproject/bin/pip-compile", line 11, in <module>
    sys.exit(cli())
  File "/Users/user/Development/Sites/myproject/lib/python3.5/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/Users/user/Development/Sites/myproject/lib/python3.5/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/Users/user/Development/Sites/myproject/lib/python3.5/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/user/Development/Sites/myproject/lib/python3.5/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Users/user/Development/Sites/myproject/lib/python3.5/site-packages/piptools/scripts/compile.py", line 128, in cli
    existing_pins[ireq.req.project_name.lower()] = ireq
AttributeError: 'Requirement' object has no attribute 'project_name'

Downgrading pip to 8.1.1 seems to fix it.

timmyomahony commented Sep 27, 2016

I'm not sure if I'm doing something wrong, but I'm still getting this error with pip==8.1.2 and pip-tools==1.6 (and python==3.5):

Traceback (most recent call last):
  File "/Users/user/Development/Sites/myproject/bin/pip-compile", line 11, in <module>
    sys.exit(cli())
  File "/Users/user/Development/Sites/myproject/lib/python3.5/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/Users/user/Development/Sites/myproject/lib/python3.5/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/Users/user/Development/Sites/myproject/lib/python3.5/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/user/Development/Sites/myproject/lib/python3.5/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Users/user/Development/Sites/myproject/lib/python3.5/site-packages/piptools/scripts/compile.py", line 128, in cli
    existing_pins[ireq.req.project_name.lower()] = ireq
AttributeError: 'Requirement' object has no attribute 'project_name'

Downgrading pip to 8.1.1 seems to fix it.

@jmbowman

This comment has been minimized.

Show comment
Hide comment
@jmbowman

jmbowman Sep 27, 2016

Contributor

@timmyomahony The fix was released with pip-tools 1.7, so if you're still on 1.6 I wouldn't expect it to work.

Contributor

jmbowman commented Sep 27, 2016

@timmyomahony The fix was released with pip-tools 1.7, so if you're still on 1.6 I wouldn't expect it to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment