-
Notifications
You must be signed in to change notification settings - Fork 3k
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 downloads packages with VCS specifiers when using --no-index and --find-links to a local directory. #3355
Comments
@dstufft, @xavfernandez, would you have the time to confirm that this behavior is a bug, and if so, would you please provide guidance as to what part of pip's codebase determines this behavior? |
I would not consider this as a bug:
Concerning |
@xavfernandez, thanks for your reply. Regarding this point,
perhaps this is the real issue. For VCS specifiers, users encode their desired package in the form of a trailing |
I am running into this issue as well. I am building wheels from VCS-specified dependencies (PEP 508 style: To xavfernandez's point, perhaps this warrants a separate flag from |
There's no version specifier when using a direct URL requirement, so now way to know what version is linked, see #5898. |
cc @uranusjr |
I have to agree with the interpretation of @xavfernandez (and @benoit-pierre). The URL requirement should absolutely trump requirements without a specifier. The URL is (conceptually) a specifier, and would override the specifier-less counterpart. The same applies to PEP 508 style; pip has no way to tell whether the wheel is generated from that exact URL or not from find-links or index information, and needs to respect the URL specification, instead of assuming the URL matches the wheel. I also believe this is in fact what most people expects (URL-based requirement over wildcard). To overcome this, Python needs a way to use the URL as a version specifier, and put it in the file name, like how the version specifier is put inside the wheel and sdist filename. You’ll need a PEP for that. |
I also agree with @xavfernandez, and in fact I view the situation more simply - [1] The |
Would it make sense, then, to raise an error if either of those options is used with a URL? That could help to head off confusion from users as to why the options aren't behaving like they might expect. |
Probably not. If the URL requirement had dependencies, the finder options would affect those, and I've no idea how you'd catch that case. |
By the way, is there an issue for the documentation linked by @pfmoore? This seems outdated (see #5271)
|
Yes, it was merged today in fact: #5933 |
Hello, is there any update planned to fix that behavior ? Any work or ongoing chances to look at in the meantime at least as a temporary replacement ? |
No. As per the comments here, this is not a bug. |
Should we close this issue? What is the action item here. |
I think we should, yes. |
This is a duplicate of #3185, however, I'm trying to document this as a bug in a clear and actionable manner for pip's maintainers. The bug regards pip downloading packages over the Internet rather than using locally available packages.
As mentioned in multiple places throughout the pip documentation (see here and here), using the options
--no-index
and--find-links </path/to/local_dir>
should cause pip to install packages directly from the user's file system, and should prevent pip from downloading and installing packages from the Internet. This behavior applies correctly to packages designated with requirements specifiers. This behavior does not apply correctly to packages designated with version control specifiers.In the case of VCS specifiers, pip ignores the combination of
--no-index
and--find-links
, and will instead attempt to clone and checkout the package over the Internet and install from the downloaded code. It does this regardless of whether a version of the package is present in the directory passed to--find-links
.The shell session below demonstrates the unexpected behavior.
Note that pip successfully downloaded the PyMySQL wheel to
~/python_packages
, but then ignored this wheel when installing PyMySQL, when specified using a VCS specifier. This is not the expected behavior.The expected behavior is that pip will use the available downloaded wheel
~/python_packages/PyMySQL-0.7.0-py2.py3-none-any.whl
. pip correctly exhibits this behavior when we provide only the package name (requirements specifier), itself:To correct this behavior, VCS specifiers should be parsed for the package name (given in the trailing
#egg=<package name>
), and search for a wheel/zip/tarball matching that package name in the local directory.The text was updated successfully, but these errors were encountered: