This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Support installation when running from an uninstalled Python
Type: enhancement Stage: resolved
Components: Distutils2 Versions: Python 3.3
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: alexis, eric.araujo, paul.moore, python-dev, r.david.murray, tarek, tshepang
Priority: normal Keywords: patch

Created on 2011-06-02 20:09 by tshepang, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
create-dir-if-nonexistent.diff tshepang, 2011-06-02 20:09 review
display-warning.diff tshepang, 2011-06-05 20:39 review
display-warning_try2.diff tshepang, 2011-06-06 19:10 review
display_warning_with_test.patch tshepang, 2011-06-07 22:27 based on review of previous patch review
Messages (22)
msg137495 - (view) Author: Tshepang Lekhonkhobe (tshepang) * Date: 2011-06-02 20:09
If I happen to not have the directory, $PREFIX/python3.3/site-packages, I get an erroneous message telling me that I don't write permissions.
msg137531 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-03 15:44
This looks like an invalid bug to me; Python itself creates the site-packages directory, with a README file if I remember correctly.  If the sysadmin removes the directory, it’s their problem, not a Python bug.  Do you agree?
msg137536 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2011-06-03 15:50
This is probably because Tshepang works in a dev environment.

I think we should have a nice message like "The installation path xxx seems not to exist, aborting installation"
msg137537 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-03 15:52
Hm, in my dev environment (checkout of 3.3), site-packages exists.
msg137538 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2011-06-03 15:58
Strange, you should get a /usr/[local]/lib/python3.3/site-packages when you just run "./configure; make"

It looks like you have a dev environment that has installed some stuff
msg137539 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2011-06-03 15:58
s/should get/should not get/
msg137547 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-03 16:18
Ah, I understand; I have a $srcdir/Lib/site-packages directory, but packaging wants to install into $prefix/site-packages, which does not exist.  +1 to adding a nice message.  Tshepang, would you like to update your patch?
msg137570 - (view) Author: Tshepang Lekhonkhobe (tshepang) * Date: 2011-06-03 18:56
On Fri, 2011-06-03 at 16:18 +0000, Éric Araujo wrote:
> Éric Araujo <merwok@netwok.org> added the comment:
> 
> Ah, I understand; I have a $srcdir/Lib/site-packages directory, but packaging wants to install into $prefix/site-packages, which does not exist.  +1 to adding a nice message.  Tshepang, would you like to update your patch?

Why not just create the directory, instead of print the warning? Is
there any harm?
msg137639 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-04 14:38
We do not want to create a directory under $prefix before installation.  This would be a sort of dirty half-installation.  When you have an uninstalled, unconfigured Python, you cannot install modules without giving a prefix option: this sounds good to me.
msg137670 - (view) Author: Tshepang Lekhonkhobe (tshepang) * Date: 2011-06-05 00:07
But this part of the code runs only when you want to install a 3rd party module isn't it? What you are proposing simply adds a delay, for the use will have to then add that directory manually. Or is there something I'm missing here?
msg137671 - (view) Author: Tshepang Lekhonkhobe (tshepang) * Date: 2011-06-05 00:09
s/use/user
msg137708 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-06-05 19:16
I'm not sure I understand your confusion, but perhaps what you are missing is that we don't support installing 3rd party packages inside a source tree, only into an installed Python, and installing Python creates the site-packages directory in $prefix.
msg137709 - (view) Author: Tshepang Lekhonkhobe (tshepang) * Date: 2011-06-05 19:44
Are there cases where my patch would result in site-packages directory installed in an unwanted place?
msg137710 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-06-05 19:54
Yes.  If the directory gets created without Python being installed, then you don't have a working python installation.  Assuming we are talking about site-packages.  I have no idea what purelib is or anything about the packaging internals.
msg137715 - (view) Author: Tshepang Lekhonkhobe (tshepang) * Date: 2011-06-05 20:39
I've changed the patch to represent what I've since learned. It now just displays a message, instead of silently creating the missing path.
msg137746 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-06 15:57
Thanks.  What about using sysconfig.is_python_build in your patch?
msg137768 - (view) Author: Tshepang Lekhonkhobe (tshepang) * Date: 2011-06-06 19:10
Find attached.
msg137951 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-09 11:46
Great!  I will edit a bit the message and commit this.
msg138107 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-06-10 16:35
New changeset ff58eec3336b by Éric Araujo in branch 'default':
Don’t try to install something when running from uninstalled source (#12246).
http://hg.python.org/cpython/rev/ff58eec3336b
msg138108 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-10 16:46
Fixed.  Welcome to Misc/ACKS !
msg138131 - (view) Author: Tshepang Lekhonkhobe (tshepang) * Date: 2011-06-10 20:05
On Fri, 2011-06-10 at 16:46 +0000, Éric Araujo wrote:
> Éric Araujo <merwok@netwok.org> added the comment:
> 
> Fixed.  Welcome to Misc/ACKS !

loveliness :)
msg147500 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-11-12 15:25
Paul Moore reported that a Python built in its checkout on Windows has no problem installing, so I’d like to revisit this.  The patch was also incomplete: The install module was changed, but people could still call “pysetup run install_dist”, and that command was not touched.

To support this on Unix too, we have to either fix sysconfig (#6087) or override some sysconfig paths in packaging.

I will shoot an email at python-dev.  There is no pattern for Lib/site-packages in .hgignore, which makes me think that this issue just never showed up before; I think I need approval before I go ahead.
History
Date User Action Args
2022-04-11 14:57:18adminsetgithub: 56455
2014-03-13 03:34:47eric.araujosetstatus: open -> closed
resolution: out of date
stage: needs patch -> resolved
2011-11-12 15:25:02eric.araujosetstatus: closed -> open

title: Warn when trying to install third-party module from an uninstalled checkout -> Support installation when running from an uninstalled Python
nosy: + paul.moore

messages: + msg147500
resolution: fixed -> (no value)
stage: resolved -> needs patch
2011-06-10 20:05:12tshepangsetmessages: + msg138131
2011-06-10 16:46:09eric.araujosetstatus: open -> closed
type: behavior -> enhancement
messages: + msg138108

resolution: fixed
stage: commit review -> resolved
2011-06-10 16:35:06python-devsetnosy: + python-dev
messages: + msg138107
2011-06-09 11:46:37eric.araujosettype: behavior
messages: + msg137951
stage: commit review
2011-06-07 22:27:48tshepangsetfiles: + display_warning_with_test.patch
2011-06-06 19:10:24tshepangsetfiles: + display-warning_try2.diff

messages: + msg137768
2011-06-06 15:57:05eric.araujosetassignee: tarek -> eric.araujo
messages: + msg137746
title: create installation path if it's non-existent -> Warn when trying to install third-party module from an uninstalled checkout
2011-06-05 20:39:31tshepangsetfiles: + display-warning.diff

messages: + msg137715
2011-06-05 19:54:11r.david.murraysetmessages: + msg137710
2011-06-05 19:44:54tshepangsetmessages: + msg137709
2011-06-05 19:16:27r.david.murraysetnosy: + r.david.murray
messages: + msg137708
2011-06-05 00:09:03tshepangsetmessages: + msg137671
2011-06-05 00:07:19tshepangsetmessages: + msg137670
2011-06-04 14:38:53eric.araujosetmessages: + msg137639
2011-06-03 18:56:38tshepangsetmessages: + msg137570
2011-06-03 16:18:57eric.araujosetmessages: + msg137547
2011-06-03 15:58:57tareksetmessages: + msg137539
2011-06-03 15:58:46tareksetmessages: + msg137538
2011-06-03 15:52:47eric.araujosetmessages: + msg137537
2011-06-03 15:50:03tareksetmessages: + msg137536
2011-06-03 15:44:43eric.araujosetmessages: + msg137531
2011-06-02 20:09:01tshepangcreate