-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Adding a direct URL dependency on setup.py breaks versioning, cached wheel is always used #7766
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
Comments
@reuben your issue is probably not related to caching. I think you are being surprised, as others, by the default pip behavior with PEP 440 direct urls. Pip considers LIBRARY is already installed ( That said pip does indeed cache LIBRARY-0.0.1-py3-none-any.whl in your case, and this is probably due to the URL containing something that looks like an archive with a version number in it's name. The reproducible example you are proposing to write will certainly help clarifying this. |
I'm explicitly installing a newer version of TOOL, so shouldn't that be an upgrade operation automatically? pip knows TOOL-0.0.1 is installed, and upgrading a package should also entail upgrading its dependencies, no?
Wrong issue/PR number?
Hm, the URL is a GitHub tarball URL from a branch, pip downloads the source and builds the wheel using setup.py. Maybe if I remove the version field from LIBRARY it won't be cached? I'll try to get that working, that'd be a suitable workaround solution I guess.
Working on it. |
I just tested with |
Hm, this is weird, I definitely do not see the same behavior as #7678. I made TOOL-0.0.1 depend on LIBRARY-0.0.1: install_requires=[
'LIBRARY@ https://github.com/reuben/pip_cache_library/tarball/[email protected]',
], I built a TOOL-0.0.1 wheel, and installed it. pip downloaded the LIBRARY-0.0.1 source and cached a wheel for it. Then I bumped the TOOL version number, and changed the dependency to LIBRARY-0.0.2: install_requires=[
'LIBRARY@ https://github.com/reuben/pip_cache_library/tarball/[email protected]',
], Again I built the new wheel, installed it with
Basically it looks like the cache key is simply the library name, rather than name + version, and so I can't get it to upgrade the library in any way, other than manually instructing pip with The fact that the last command works but installing the wheel doesn't makes me suspect this logic is implemented twice? Maybe the bug I'm seeing is actually in setuptools, or the wheel package? I don't know anything about Python packaging internals so it's hard for me to know. |
Ah, nevermind, what I'm seeing is exactly what's described in #5780. |
It's even more different than I thought. On the command line, this doesn't work:
It requests the URL including the "@0.0.2" part, which is a 404. But in |
I've just tested this setup.py: from setuptools import setup
setup(
name="TOOL",
version="0.0.1",
install_requires=[
"LIBRARY@ https://github.com/reuben/pip_cache_library/tarball/[email protected]",
],
)
|
I've been testing by building and installing a wheel (because that's how I distribute TOOL to users). So, that same setup call, but |
I still can't reproduce: $ python setup.py bdist_wheel
$ pip install dist/TOOL-0.0.1-py3-none-any.whl Processing ./dist/TOOL-0.0.1-py3-none-any.whl
Collecting LIBRARY@ https://github.com/reuben/pip_cache_library/tarball/[email protected]
ERROR: HTTP error 404 while getting https://github.com/reuben/pip_cache_library/tarball/[email protected] |
Sorry, I think I got tricked by the very bug I'm reporting here. The first time I installed it, the dependency URL didn't have the "@0.0.1" in it, and then for subsequent installs, because of this bug, pip never tried to fetch the URL at all, so I wasn't actually testing the new URL. |
Sure, that works for me. |
Environment
Description
Situation: project TOOL version 0.0.1 depends on project LIBRARY version 0.0.1. Project LIBRARY is not published on PyPI, so project TOOL uses a direct URL dependency in
install_requires
, pointing to a GitHub tarball:A user installs project TOOL for the first time from a wheel published by the project TOOL maintainers, using
pip install TOOL-0.0.1-py3-none-any.whl
.pip
fetches the tarball from GitHub, saves it into its cache, and the install works fine.Project TOOL author wands to update its LIBRARY dependency to 0.0.2. But there's no version references anywhere, as direct URL dependencies don't support version info. Instead of being able to make a new wheel with correctly versioned dependencies, project TOOL author must instruct all users to manually update to the new version of project LIBRARY.
Expected behavior
Pip does not cache direct URL dependencies since they don't have version info and therefore there's no cache invalidation criteria.
How to Reproduce
I don't have simple examples to share, but I guess I'll write them over the weekend to make it easier to reproduce this.
Output
In this log I'm installing (in a fresh virtual environment) TOOL==0.0.1, which depends on LIBRARY==0.0.1. Then, I update LIBRARY to 0.0.2, by pushing new commits to the same branch. I expect new installs to pick up the new version, but yet, when I install TOOL==0.0.2, it picks up the old version of LIBRARY from the cache:
The text was updated successfully, but these errors were encountered: