-
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
Upgrading to distribute 0.7 (which depends on the new setuptools 0.7) ends in tears #986
Comments
the distribute project had released a new "wrapper" version of distribute that does nothing but depend on the new setuptools (the merge of setuptools and distribute). they've since taken it down for now. decision pending on what pip's position will be on supporting upgrading to the new distribute.... |
with distribute-0.6.X upgrades, even though pip uninstalled distribute as part of the upgrade, it ran the install subprocess with the cwd equal to the build dir, so it could import setuptools from the unpacked download. but now, distribute-0.7 is just a shell (that depends on setuptools), that contains no importable setuptools that pip can use (and by default, setuptools gets queued to be installed after distribute) here's a thought on adding some special logic to make this work: when an upgrade to distribute==0.7 is detected:
so the order would end up being:
|
If possible we should ship this with 1.3.x, too. |
Sounds like a reasonable plan, although I can't get up any enthusiasm for it. I suspect it would still fail for Python 3, because of the unrelated 2to3 requirement/issue. That problem will go away once setuptools removes the requirement for 2to3, but I assume that won't be before 0.8. Actually, you say "when an upgrade to distribute==0.7 is detected" - should that not be ">= 0.7"? I wouldn't want to force someone upgrading to a single-source 0.8 to have to go via the 2to3 0.7... We should keep the relevant code isolated so that it can be removed again once use of distribute has diminished to the point where it's not an issue - we don't want to have to maintain this indefinitely. |
That's right - a unified Python 2/3 code base won't be before 0.8, although I hope to make that release sooner than later. Don't let the number increment suggest it's anything but top priority following the merge. And yes, I believe any distribute>=0.7 is correct. I do have plans to release 0.7.1 which will reference setuptools on pypi (removing dependency_links to get setuptools from bitbucket). |
One other thought. pip 1.4 will support installation from wheels. If setuptools 0.7 is available in wheel format on PyPI, we could simply automatically force wheel installation for setuptools, and bypass the whole problem. That may be less work, and would likely involve less "hacky" code, for what is essentially an interim solution. @qwcode, is that a possible alternative? @jaraco - it would mean hosting wheels for setuptools, is that viable? Obviously, if we release a 1.3.x that needs to fix this issue, then this idea is a non-starter. |
ok, my plan is not good enough since the code is not 2&3 compatible yet. sorry, I mistakenly thought it would be. going to the trouble to fix this just for python2 is no good IMO. 4 other thoughts:
|
for #4, we just need 2to3 to run before we try to run egg_info in python3. |
I'll have some time on Thursday. I'll look into merging the code patches to provide native Python 3 support and provide a report back on how close that would be. Another option: the distribute shell package could include both the Python 2 and 2to3-converted Python 3 code plus wrapper packages/modules ('pkg_resources', 'setuptools') that selectively import the proper code. It would be hacky, but I'd be okay with that in the shell package. As for wheel support, I'm still largely naive about wheels, so I would need to learn more about them. My suspicion, however, is that migrating all existing clients to wheels is a more challenging problem fraught with even more compatibility struggles. My goal with setuptools 0.7 is to try to remain as compatible as possible and focus primarily on migrating users from distribute back to a single project for setuptools. |
Having two source trees is probably a good solution in this case. It makes the package big, but the install would be quicker. First running 2to3 on the distribute source and then not install it, and then install setuptools and run 2to3 on that, would be annoying and slow. |
to be clear, the idea of including a 2&3 importable setuptools in the distribute shell, will still leave pip failing in python3 when we get to installing the new setuptools, which is still not 2&3. It's 2 problems:
for #1, either
for #2, either
|
@jaraco I started working on a pip-only solution for this. one thing I can't fathom is that you can't run "python setup.py egg_info" more than once for distribute-0.7 without it getting confused somehow, and being unable to locate egg_info
|
Where is the distribute source now? Tareks repo does't contain the 0.7 attempts as far as I can tell, and none of the pypa repos seem to have a version of Distribute. The reason I ask is that I wondered if it was possible to make a Distribute 0.7 that simply did not use setuptools at all, and just distutils. I don't know, but it might be worth a try. |
A thought. For the problem of needing an importable setuptools, there is a 3rd option (I think):
|
@regebro I got my distribute source archive from here: https://bitbucket.org/pypa/setuptools/downloads @pfmoore "just do python setup.py". that's the gist of the solution I'm working on now. it's working, but I need help understanding, why I can't run "egg_info" more than once for the distribute-0.7 source. |
btw, the "can't run egg_info more than twice problem" seems to be due to the empty distribute in the cwd blocking the installed distribute, once the egg_info is built, hence it can't find/use the egg_info plugin |
another plan, based on IRC conversations with @jezdez and @dstufft override distribute upgrades (to >=0.7) as an uninstall-distribute/install-setuptools operation, i.e. don't ever install distribute>=0.7 this combined with the 2to3/python3 fix I have working, would be a pip-only solution. working on this now... |
posted a draft of a pip-only solution for this in #992 |
@regebro: all the code for distribute and setuptools is now maintained in named branches of /pypa/setuptools. The Distribute 0.7 shell can be found in the 'distribute-legacy' branch. I realize in retrospect that name isn't the best name, but it's what we have. I've considered a distutils-only package, except that a distutils-only package can't "require" setuptools. Or can it? I was thinking the setup.py could be updated to fallback to distutils (when setuptools isn't available), but because the package metadata would have been built with setuptools/distribute, it would contain the requirement and PIP would have installed it. |
@qwcode: I believe the reason that egg_info only runs once in that environment is because when your run egg_info once, that creates distribute.egg-info, superseding your installation of distribute on which you're relying to run egg_info. Because Distribute 0.7 doesn't implement any distutils commands, once distribute-0.7 egg-info is created, you no longer have setuptools capabilities. Does that explain the behavior? Thanks for the patch on pip to address the issue. Since this fix only affects new pip installs, it won't address the issue for users using a pre-installed version of pip, but that's possibly an acceptable compromise. It at least provides a path to upgrade. I'm tempted to accept this approach and then focus on the unified Python 2/3 codebase work, rather than spend time bundling versions into Distribute 0.7. |
@regebro: I remember now why falling back to distutils in Distribute 0.7 is not viable. It's because the error is triggered before the Distribute 0.7 setup.py is invoked. Pip invokes 'python -c import setuptools' itself, and that's where the error occurs. That detail isn't clear from the error as reported above, but it is more clear in the initial reports on distutils-sig. |
that's what I surmised as well after some head scratching. my patch resorts to deleting it before the run of egg_info
I think it's acceptable. I think pip/virtualenv needs to start stating what version of setuptools it's been tested with anyway, and not promote users eagerly upgrading. |
solution for pip-1.4 merged in #992 |
I've made some progress on a distribute 0.7 that will work with older versions of pip, but it still has problems:
Although the process runs cleanly and the latest setuptools is installed, the easy_install scripts aren't present (presumably because they were removed by the uninstallation of distribute). While this technique is nicer than that of distribute 0.7/0.7.1, I believe the recommended procedure will be to upgrade pip first. |
what's happening here is setuptools is installed on top of distribute. yes, upgrading pip first, will have to be good enough. |
I can't reproduce that problem when updating to distribute 0.7.3 via:
That works for me on both Python 2 and 3. I don't know whether users for whom that broke could have used
AFAICT, we should just push distribute 0.7.3 to the cheeseshop and be done. |
@tseaver , to be clear, 0.7.3, improves the situation by including the setuptools source. the original report from the user was valid. as for the discrepancy between jason and you using 0.7.3, it has to do with the order that pip attempts to install things. pip is normally agnostic to order, but in this one case it matters, and jason's direct install command doesn't result in the "right" order. |
This just happened:
To make this more precise: I get that "upgrading" distribute means uninstalling it and installing setuptools. I just wish that process wouldn't fail.
The text was updated successfully, but these errors were encountered: