-
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
Requirement already satisfied by egg but package not installed #3710
Comments
This is probably a setuptools bug? I think we're just using |
Well, the packages aren't "installed" in the sense that they can't be imported without first being "required" by pkg_resources (they're not listed in easy-install.pth). They are "installed" in the hidden multi-package sense. Do you know which call to pkg_resources is used to determine what's installed? Does it make sense for pip to consider hidden packages as installed and satisfying its install operation? |
It probably does not make sense for hidden packages to count as installed. You can see the call to this at pip/req/req_install.py#L992-L1031, but the call we're using is: self.satisfied_by = pkg_resources.get_distribution("REQNAME") |
I'll definitely take a look at this in more depth later. Thanks for the reference. |
So I've traced the call to get_distribution to this call in get_provider, in particular:
So it seems that intentional or not, get_distribution will return a distribution not in the working set but one that's reachable through I'm thinking there are two ways to deal with this:
I'm leaning toward the first option, meaning that pip wouldn't touch distributions that would not be importable (since it also won't install distributions that won't be importable). Thoughts? |
The second option will probably not mesh well with Debians patching. They block us from uninstalling stuff that is installed by the OS. The first option sounds like a good idea to me. Sent from my iPhone
|
First option also 👍 |
For people struggling with hack to get it right, I had similar issue:
I deleted the directory |
@pradyunsg I haven't. It's still ticketed as pypa/setuptools#817. I've had little time to commit to advancing setuptools. If you could drum up some enthusiasm on that ticket to the point that someone suggests a patch, I'd be all for that. |
Is there any reason this couldn't simply be def get_provider(moduleOrReq, include_hidden=True):
"""Return an IResourceProvider for the named module or requirement"""
if isinstance(moduleOrReq, Requirement):
return working_set.find(moduleOrReq) or (include_hidden and require(str(moduleOrReq))[0]) so I don't have time to make this into a full-fledged patch at the moment, but if anyone wants to they are welcome to the idea 😄 |
It works ! Thanks ! |
Blocked on pypa/setuptools#817. |
Is this the same issue, or something else? $ mkdir piptrub
$ cd piptrub
$ git clone [email protected]:jazzband/pip-tools
$ cd pip-tools
$ python3 -m venv ../venv
$ . ../venv/bin/activate
$ pip install -U pip
$ pip --version
pip 20.0.2 from /home/andy/Code/piptrubbl/venv/lib/python3.8/site-packages/pip (python 3.8)
$ python -m pip --version
pip 20.0.2 from /home/andy/Code/piptrubbl/venv/lib/python3.8/site-packages/pip (python 3.8)
$ python -V
Python 3.8.2
$ which python
/home/andy/Code/piptrubbl/venv/bin/python
$ pip install .
$ pip uninstall -y pip-tools
$ python -m pip install pip-tools
Requirement already satisfied: pip-tools in /home/andy/Code/piptrubbl/pip-tools (4.5.2.dev18+g1d0883f)
Requirement already satisfied: click>=7 in /home/andy/Code/piptrubbl/venv/lib/python3.8/site-packages (from pip-tools) (7.1.1)
Requirement already satisfied: six in /home/andy/Code/piptrubbl/venv/lib/python3.8/site-packages (from pip-tools) (1.14.0)
Requirement already satisfied: pip>=20.0 in /home/andy/Code/piptrubbl/venv/lib/python3.8/site-packages (from pip-tools) (20.0.2)
$ pip freeze
click==7.1.1
six==1.14.0
$ pip install pip-tools
Collecting pip-tools
Using cached pip_tools-4.5.1-py2.py3-none-any.whl (41 kB)
Requirement already satisfied: click>=7 in /home/andy/Code/piptrubbl/venv/lib/python3.8/site-packages (from pip-tools) (7.1.1)
Requirement already satisfied: six in /home/andy/Code/piptrubbl/venv/lib/python3.8/site-packages (from pip-tools) (1.14.0)
Installing collected packages: pip-tools
Successfully installed pip-tools-4.5.1 |
After reading through it, I think the issue you're illustrating is that after
So there's definitely something different between our two environments.
I've just closed that ticket. I don't believe investment in pkg_resources is the right place for this issue. Instead, the latest |
Well I'm having trouble reproducing now using that same procedure, but I think the trouble was actually a duplicate of #6558. EDIT: Ah, I wasn't reproducing because I need to run $ mkdir piptrub
$ cd piptrub
$ git clone [email protected]:jazzband/pip-tools
$ cd pip-tools
$ python3 -m venv ../venv
$ . ../venv/bin/activate
$ pip install -U pip
$ pip install -e .
$ pip uninstall -y pip-tools
$ python -m pip install pip-tools It is surprising that |
This should be resolved by #7955. |
Description:
In this example, I'm using
setuptools
because that's the package I was developing, but the issue could be replicated with any package.I'd just finished developing setuptools and wanted to install a final version, so I did
python setup.py develop --uninstall
. Now I have no setuptools installed, so I want to use pip to install it, but when I attempt to do so, it fails to install, saying the requirement is already satisfied. However, the egg it references about being already satisfied isn't actually on sys.path, so it's not installed (and thus not satisfied for install).It seems that the presence of an egg from a previous install of setuptools is blocking the installation of any version.
As I'm working toward getting away from using easy_install and relying more on pip, I wanted to use pip to install setuptools rather than use the bootstrap script or install from source.
I would expect pip to be able to install the requested in this case, even if it has to uninstall extant eggs or just add them to the easy-install.pth file to make them installed.
I have found that if I repeatedly run
pip unistall -y setuptools
until it no longer finds any versions, I can then install setuptools.What I've run:
The text was updated successfully, but these errors were encountered: