-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
egg-info in local directory makes pip think package is installed #6558
Comments
I don’t consider this a bug, in the sense of how pip “discovers” installations (i.e. looks for metadata directories), and that the package you want to install does actually present in FWIW, this kind of confusion is what the src/ layout tries to resolve. |
This is an issue for build automation, which cannot necessarily assume specific package layout.
It is also surprising behavior in that pip's concept of "installed" packages depends on cwd. Maybe this concept is not a good idea and should be changed?
…On May 31, 2019 4:50:19 AM UTC, Tzu-ping Chung ***@***.***> wrote:
I don’t consider this a bug, in the sense of how pip “discovers”
installations (i.e. looks for metadata directories), and that the
package you want to install does actually present in `sys.path`, making
it effectively “installed” (i.e. available for import) by your runtime
at that time.>
>
FWIW, this kind of confusion is what the [src/
layout](pypa/packaging.python.org#320) tries
to resolve.>
>
-- >
You are receiving this because you authored the thread.>
Reply to this email directly or view it on GitHub:>
#6558 (comment)
|
Moreover, without egg-info, the package is not detected by pip as "installed", although it is in sys.path.
…On May 31, 2019 4:50:19 AM UTC, Tzu-ping Chung ***@***.***> wrote:
I don’t consider this a bug, in the sense of how pip “discovers”
installations (i.e. looks for metadata directories), and that the
package you want to install does actually present in `sys.path`, making
it effectively “installed” (i.e. available for import) by your runtime
at that time.>
>
FWIW, this kind of confusion is what the [src/
layout](pypa/packaging.python.org#320) tries
to resolve.>
>
-- >
You are receiving this because you authored the thread.>
Reply to this email directly or view it on GitHub:>
#6558 (comment)
|
Well, it's python's concept (as you say, the package is on Yes, it's surprising, but it's been core Python language behaviour essentially forever, so it would be a significant language change to modify it. |
I understand your point from a pip implementation perspective, but pip's concept of installed packages does not currently match python's, as it depends on the egg-info, and that they should match appears not so strongly argued.
From the perspective of an user who is well aware of how python works, this still managed to be a surprising footgun, and the fact that it depended on what is in setup.py made it more difficult to pinpoint.
…On May 31, 2019 8:10:03 AM UTC, Paul Moore ***@***.***> wrote:
> It is also surprising behavior in that pip's concept of "installed"
packages depends on cwd. Maybe this concept is not a good idea and
should be changed?
Well, it's *python's* concept (as you say, the package is on
`sys.path`). Pip requires additional metadata (the `egg-info`
directory) to manage the package, but that's the only difference (and
just means that sometimes pip doesn't recognise a package that Python
considers to be present).
Yes, it's surprising, but it's been core Python language behaviour
essentially forever, so it would be a significant language change to
modify it.
|
The expectation that the default behavior of Are there any functional impacts to removing the current working directory from |
I don't see mentioned here these specific confusions:
$ git clone [email protected]:jazzband/pip-tools
$ cd pip-tools
$ python -m venv venv
$ . ./venv/bin/activate
$ pip install -U pip
...
Successfully installed pip-20.0.2
$ pip install -e .
...
Successfully installed click-7.1.1 pip-tools six-1.14.0
$ pip uninstall -y pip-tools
...
Successfully uninstalled pip-tools-4.5.2.dev18+g1d0883f
$ python -m pip install pip-tools
Requirement already satisfied: pip-tools in /home/andy/Code/piptrubbl/pip-tools (4.5.2.dev18+g1d0883f)
...
$ pip-sync --help
zsh: command not found: pip-sync
$ pip freeze
click==7.1.1
six==1.14.0
$ pip freeze --all
click==7.1.1
pip==20.0.2
setuptools==41.2.0
six==1.14.0
$ pip install pip-tools
...
Successfully installed pip-tools-4.5.1
$ deactivate
$ rm -rf venv pip_tools.egg-info
$ python -m venv venv
$ . ./venv/bin/activate
$ touch pip_tools.egg-info
$ pip install -U pip
...
Successfully installed pip-20.0.2
$ python -m pip install pip-tools
...
ValueError: ("Missing 'Version:' header and/or PKG-INFO file at path: /home/andy/Code/piptrubbl/pip-tools/pip_tools.egg-info", pip-tools [unknown version] (/home/andy/Code/piptrubbl/pip-tools))
$ pip install pip-tools
...
Successfully installed click-7.1.1 pip-tools-4.5.1 six-1.14.0 IMO this behavior is not sane, on multiple counts. |
C/f #2926 (of which this is essentially a duplicate). |
I see that it also relates to dealing with with local egg info dirs, and with divergent behavior depending on how pip is invoked. But notably, that primary issue (pip freeze including the current directory) is not reproduced by the session in my previous comment. Unless I misunderstand that linked issue altogether. |
As far as I can see, this is now fixed by #7955 ! 🎆 |
Yes, I think we can close this one too. |
Environment
Description
A
PACKAGE.egg-info
directory in current working directory can makepip install WHEELFILE
to say "Requirement already satisfied" and not actually install the wheel file.Expected behavior
pip install
would install the package in the wheel file to the appropriatesite-packages
directory, so that it remains available after chdir-ing out of the current directory.How to Reproduce
Reproducing shell script:
Output
The text was updated successfully, but these errors were encountered: