-
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 install --upgrade distribute" fails with Python 3 #650
Comments
Yes, the I'd certainly be happy with a docs note, at least as a stopgap until/unless someone is motivated enough to try to find a better fix. I've often wished there was a command-line flag to invoke python without the current-directory-on-sys.path behavior. |
In the meantime can we avoid uninstalling distribute during an upgrade? Things get messy with --ignore-installed and packages requiring distribute. |
I'm not sure how avoiding uninstalling distribute would fix this problem? |
With some packages that list distribute as a req, pip tries to upgrade distribute, uninstalls the older one, fails, and leaves a broken virtualenv. Possibly mainly with my wheel patches. On Aug 29, 2012, at 4:52 PM, Carl Meyer notifications@github.com wrote:
|
Ah, I see. Yeah, a patch to make pip ignore distribute as a |
How about a general-purpose --ignore=name (although --ignore is taken as short for --ignore-installed) |
--exclude or something. On 30 August 2012 14:44, dholth notifications@github.com wrote:
|
I'm not opposed to the |
Avoid a lot of pain by adding to pip/req.py: for requirement in to_install: if requirement.name == "distribute": logger.notify(...); continue |
Fix for non-2to3 distribute upgrading problems: dholth@341e71d |
How does the fix break everything else? |
@dholth not sure of the context of your last comment - can you clarify. |
Last para of bug description On Sep 6, 2012, at 2:24 AM, Paul Nasrat notifications@github.com wrote:
|
Having this issue when running |
I'm curious as well to how the attempted fix above "breaks everything else" Also, an excerpt:
Is that import that was removed ever required? |
That import is quite important, yes, and removing it is what "breaks everything else". Setuptools monkeypatches the distutils framework when it is imported to provide some additional features, and forcing the import of it before executing setup.py is a core pip feature; it's what allows pip to provide uniform handling of projects that do and don't use setuptools in their setup.py. With that import removed, "pip install" will break for any project that has "from distutils.core import setup" rather than "from setuptools import setup" in its setup.py. |
At a minimum I would hope that it's possible to do at least some of the following:
|
In addition to @pfmoore's list, I'd appreciate if |
We've had features in either bugs or testing that just skip trying to install distribute or setuptools at all... so pip says "I can't do that Dave" instead of "crash". |
the install side is the right place to solve this. Or use grep -v Jamey Sharp notifications@github.com wrote:
|
As a workaround, is it reasonable to use easy_install instead of pip to upgrade distribute? I just did that and nothing seems to have broken in any obvious way. |
Absolutely. I don't know if you keep the possibility to uninstall it from pip, but hey, it's distribute. You need it. :-) This is not an important bug in any way, it's just annoying, and it keeps cropping up because people run into it and post new bug reports. :-) |
It may not be an important bug in pip, but as you say, people keep running into it because they want to upgrade some package that happen to explicitly depend on distribute. That makes it pretty important for the users because it breaks the normal workflow. |
with the release of distribute-0.7.3 (and setuptools>=0.8 which is py2/py3 compatible code), this is no longer an issue.
|
Essentially, since pip uses distribute to do the upgrade, the "import distribute" statements in the pip-provided scripts to gather egg_info and install will end up importing it from the downloaded package instead of from the system packages. But that code is Python 2, and you get syntax errors:
File "setuptools\dist.py", line 103
SyntaxError: invalid syntax
Command python setup.py egg_info failed with error code 1 in C:\Users\root\AppData\Local\Temp\pip\build\distribute
Now, I found solutions for this, but they break everything else (see https://github.com/regebro/pip/commit/4c11aaaed1e10eabfbc9fa60a8a8f0e2df813032 ) so I'm not sure this is fixable without a lot of special casing for Distribute. Seeing as this bug only can appear in Python 3 with packages that have a module called "setuptools" it's a pretty marginal edge case. Perhaps just noting that you can't upgrade Distribute with pip under Python 3 but will have to reinstall it instead is an acceptable solution?
The text was updated successfully, but these errors were encountered: