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

Strange exception when executing on a requirements.txt containing a URL to a tarball #416

Closed
Lucas-C opened this issue Nov 23, 2016 · 4 comments

Comments

@Lucas-C
Copy link
Contributor

Lucas-C commented Nov 23, 2016

Steps to replicate
  1. echo https://files.pythonhosted.org/packages/6a/11/114c67b0e3c25c19497fde977538339530d8ffa050d6ec9349793f933faa/lockfile-0.10.2.tar.gz > requirements.in
  2. pip-compile requirements.in
Expected result

A meaningful error.

Actual result

This exception:

AttributeError: 'NoneType' object has no attribute 'name'
Details

I understand that URLs to tarballs in requirement files may not be supported by pip-compile, but then a more helpful error message would be great.

I had a look at the code, the issue comes from here:
https://github.com/nvie/pip-tools/blob/master/piptools/scripts/compile.py#L141
It seems that ireq.req is None for URLs. Hence when the key_from_req function tries to access its .name attribute it crashes.

@ewjoachim
Copy link

It seems to be the same for "-e" requirements.

@Groxx
Copy link

Groxx commented Mar 6, 2017

Similar to -e requirements, you probably need to name the file - otherwise it can't be shared with other dependencies that might use it. Does it work if you add ....tar.gz#egg=some_name to the end?

That said, nameless dependencies would be useful / less annoying sometimes, even if they're somewhat fundamentally crippled for a dependency manager. Might become an option in the long run?

@vphilippon
Copy link
Member

The AttributeError: 'NoneType' object has no attribute 'name' is something that was fixed in master.
I tried to reproduce, it doesn't happen here anymore.
Instead I get:

piptools.exceptions.UnsupportedConstraint: pip-compile does not support URLs as packages, unless they are editable. Perhaps add -e option? (constraint was: https://files.pythonhosted.org/packages/6a/11/114c67b0e3c25c19497fde977538339530d8ffa050d6ec9349793f933faa/lockfile-0.10.2.tar.gz (from -r requirements.in (line 1)))

So here's the expected meaningful error.

@Groxx pip 9.0.0 dropped the support for the autodetection of requirement names from URLs, so the #egg=some_name part is pretty mandatory (https://github.com/pypa/pip/blob/master/NEWS.rst), unless it get implemented back in pip-tools. But something tells me they dropped that support for some reason on the pip side. You can open another issue (or even submit a PR) for that if you feel it's worth discussing.

@davidovich Like the other one poked you for, this is fixed in master.

@davidovich
Copy link
Contributor

closed by #485

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

5 participants