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

pip-compile: AttributeError: 'NoneType' object has no attribute 'name' #421

Closed
alex opened this issue Dec 7, 2016 · 11 comments
Closed

pip-compile: AttributeError: 'NoneType' object has no attribute 'name' #421

alex opened this issue Dec 7, 2016 · 11 comments

Comments

@alex
Copy link

alex commented Dec 7, 2016

Describe the issue briefly here.

Steps to replicate
  1. git clone https://github.com/pyca/cryptography
  2. cd cryptography/
  3. pip-compile dev-requirements.txt
Expected result

Either it working, or a clear error message.

Actual result
Traceback (most recent call last):
  File "/Users/alex_gaynor/.pyenv/versions/pypy-5.6.0/bin/pip-compile", line 11, in <module>
    sys.exit(cli())
  File "/Users/alex_gaynor/.pyenv/versions/pypy-5.6.0/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/Users/alex_gaynor/.pyenv/versions/pypy-5.6.0/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/Users/alex_gaynor/.pyenv/versions/pypy-5.6.0/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/alex_gaynor/.pyenv/versions/pypy-5.6.0/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Users/alex_gaynor/.pyenv/versions/pypy-5.6.0/site-packages/piptools/scripts/compile.py", line 141, in cli
    key = key_from_req(ireq.req)
  File "/Users/alex_gaynor/.pyenv/versions/pypy-5.6.0/site-packages/piptools/utils.py", line 41, in key_from_req
    return req.name.lower()
AttributeError: 'NoneType' object has no attribute 'name'
@svisser
Copy link

svisser commented Dec 11, 2016

This may be a duplicate of #416.

@cmc333333
Copy link

This might be a regression -- I was seeing the same until I downgraded to piptools==1.7.0
Failing Environment:
Linux (Alpine)
pyenv, cpython 3.6.0
pip==9.0.1
piptools==1.8.0

@jredwards
Copy link

jredwards commented Feb 8, 2017

@cmc333333 I'm also seeing this error in 1.8.0 but not in 1.7.0, with what seems like a perfectly reasonable list of packages.

using pip==9.0.1

@dogweather
Copy link

dogweather commented Apr 3, 2017

Failing for me with cpython 3.5.3. I'm wondering what the commonalities are. Clearly, the current pip-tools version (1.8.2) must be working for someone. (?)

@dogweather
Copy link

I found I could get it to work by checking for None in compile.py before calling key_from_req at line 131:

        for ireq in ireqs:
            if ireq.req is None:
                continue
            key = key_from_req(ireq.req)

This doesn't solve the root cause of why Nones make it into that list, but this seems to function fine.

@vphilippon
Copy link
Member

vphilippon commented Apr 10, 2017

I just noticed something while trying to reproduce:
If you rename dev-requirements.txt to dev-requirements.in it works.
If a dev-requirements.txt with some -e in it exists, it will fail.

After some more testing, I found that if the output file (the .txt one) has -es in it , it will fail.
Ex:

  1. git clone https://github.com/pyca/cryptography
  2. cd cryptography/
  3. mv dev-requirements.txt dev-requirements.in
  4. pip-compile dev-requirements.in -> succeeds
  5. pip-compile dev-requirements.in -> now fails, as dev-requirements.txt exists with a -e in it
  6. pip-compile dev-requirements.in -o foobar.txt -> succeeds
  7. pip-compile dev-requirements.in -o foobar.txt -> now fails, as foobar.txt exists with a -e in it
  8. Edit foobar.txt and remove the lines with -e
  9. pip-compile dev-requirements.in -o foobar.txt -> succeeds
  10. pip-compile dev-requirements.in -o foobar.txt -> now fails, as foobar.txt contains -e.

That makes sense, as the part failing is the one where the output file is read to get the previously existing pins. looks like there's something not handling the editables link in that part.

@vphilippon
Copy link
Member

I tried to reproduce on master, this seems to be fixed (likely related to #484).
@davidovich looks like this can be closed.

@davidovich
Copy link
Contributor

Closing as per #485

@Lucas-C
Copy link
Contributor

Lucas-C commented Jul 3, 2017

There is one remaining bug to fix that raises a AttributeError: 'Requirement' object has no attribute 'name':
#540

@Lucas-C Lucas-C reopened this Jul 3, 2017
@vphilippon
Copy link
Member

Closed by #540

@slippers
Copy link

slippers commented Jun 9, 2020

i suddenly got this error when compiling with an -e line. which was there before and compiled.

Fixed by running pip install pip-tools --upgrade and moved from 4.5.1 to 5.2.1

/python3.6/site-packages/piptools/utils.py", line 29, in key_from_ireq if ireq.req is None and ireq.link is not None: AttributeError: 'ParsedRequirement' object has no attribute 'req'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants