classification
Title: Python 2.7.1 does not start when "./configure" is used with "--prefix" != "--exec-prefix"
Type: behavior Stage: resolved
Components: Distutils, Distutils2 Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: barry Nosy List: barry, eric.araujo, georg.brandl, hoel, python-dev, tarek
Priority: normal Keywords:

Created on 2011-02-10 13:47 by hoel, last changed 2011-10-09 07:16 by eric.araujo. This issue is now closed.

Messages (9)
msg128292 - (view) Author: Berthold Höllmann (hoel) Date: 2011-02-10 13:47
I do get (with 2.7.1):

> python
Traceback (most recent call last):
  File "/usr/local/gltools/python/Python-2.7/lib/python2.7/site.py", line 553, in <module>
    main()
  File "/usr/local/gltools/python/Python-2.7/lib/python2.7/site.py", line 535, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/local/gltools/python/Python-2.7/lib/python2.7/site.py", line 268, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/local/gltools/python/Python-2.7/lib/python2.7/site.py", line 243, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/local/gltools/python/Python-2.7/lib/python2.7/site.py", line 233, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/local/gltools/python/Python-2.7/lib/python2.7/sysconfig.py", line 535, in get_config_var
    return get_config_vars().get(name)
  File "/usr/local/gltools/python/Python-2.7/lib/python2.7/sysconfig.py", line 434, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/usr/local/gltools/python/Python-2.7/lib/python2.7/sysconfig.py", line 287, in _init_posix
    raise IOError(msg)
IOError: invalid Python installation: unable to open /usr/local/gltools/python/Python-2.7/lib/python2.7/config/Makefile (No such file or directory)

The Makefile is platform dependendent und is located at

/usr/local/gltools/python/Python-2.7/linux_x86_64/lib/python2.7/config/Makefile

This problem is fixed for me by a simple pach:

> diff -c /usr/local/gltools/python/Python-2.7/lib/python2.7/sysconfig.py /usr/local/gltools/python/Python-2.7/lib/python2.7/sysconfig.py~
*** /usr/local/gltools/python/Python-2.7/lib/python2.7/sysconfig.py     2011-02-10 14:33:34.000015000 +0100
--- /usr/local/gltools/python/Python-2.7/lib/python2.7/sysconfig.py~    2011-02-10 14:28:17.001245000 +0100
***************
*** 271,277 ****
  def _get_makefile_filename():
      if _PYTHON_BUILD:
          return os.path.join(_PROJECT_BASE, "Makefile")
!     return os.path.join(get_path('platstdlib'), "config", "Makefile")
  
  
  def _init_posix(vars):
--- 271,277 ----
  def _get_makefile_filename():
      if _PYTHON_BUILD:
          return os.path.join(_PROJECT_BASE, "Makefile")
!     return os.path.join(get_path('stdlib'), "config", "Makefile")
  
  
  def _init_posix(vars):
msg128434 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2011-02-12 00:30
The suggested change works for me, both when prefix == exec_prefix and when it doesn't.  All standard tests pass, so the fix should be committed.  I'm holding off on doing that to see whether it's applicable to other versions, though if 3.2 is affected, Georg will have to pronounce on the patch.  (My opinion is that it can easily wait for 3.2.1).
msg128437 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011-02-12 07:23
That is my opinion as well.
msg128572 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2011-02-14 20:05
Fixed in release27-maint: r88422

I am unable to reproduce in Python 3.1 (which does not have the sysconfig module) or 3.2 (which uses a different build-flags specific location for its Makefile).
msg129326 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-02-25 00:35
Barry, could you try reproducing with distutils.sysconfig?
msg129328 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2011-02-25 02:36
On Feb 25, 2011, at 12:35 AM, Éric Araujo wrote:

>Éric Araujo <merwok@netwok.org> added the comment:
>
>Barry, could you try reproducing with distutils.sysconfig?

I'm not quite sure what you mean, but configuring Python 3.1 with different
--prefix and --exec-prefix works just fine.
msg129549 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-02-26 14:04
I was unclear.  distutils.sysconfig does not play a role in the startup of python anymore.  My question was: does distutils.sysconfig._get_makefile_filename have the same bug as the one that was fixed in sysconfig._get_makefile_filename?
msg145219 - (view) Author: Roundup Robot (python-dev) Date: 2011-10-09 06:59
New changeset 6542e4028ed2 by Éric Araujo in branch '3.2':
As it turns out, this bug was already in the tracker: #11171
http://hg.python.org/cpython/rev/6542e4028ed2
msg145227 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-09 07:16
> My question was: does distutils.sysconfig._get_makefile_filename have
> the same bug as the one that was fixed in sysconfig._get_makefile_filename?

It does, I fixed it in 9afd3d54c3cb.
History
Date User Action Args
2011-10-09 07:16:56eric.araujosetmessages: + msg145227
stage: patch review -> resolved
2011-10-09 06:59:48python-devsetnosy: + python-dev
messages: + msg145219
2011-02-26 14:04:13eric.araujosetnosy: barry, georg.brandl, hoel, tarek, eric.araujo
messages: + msg129549
2011-02-25 02:36:21barrysetnosy: barry, georg.brandl, hoel, tarek, eric.araujo
messages: + msg129328
title: Python 2.7.1 does not start when "./configure" is used with "--prefix" != "--exec-prefix" -> Python 2.7.1 does not start when "./configure" is used with "--prefix" != "--exec-prefix"
2011-02-25 00:35:05eric.araujosetnosy: barry, georg.brandl, hoel, tarek, eric.araujo
messages: + msg129326
2011-02-14 20:05:09barrysetstatus: open -> closed
versions: - Python 3.1, Python 3.2
nosy: barry, georg.brandl, hoel, tarek, eric.araujo
messages: + msg128572

resolution: fixed
2011-02-12 07:23:03georg.brandlsetnosy: barry, georg.brandl, hoel, tarek, eric.araujo
messages: + msg128437
2011-02-12 00:30:57barrysetnosy: + georg.brandl
messages: + msg128434
2011-02-11 23:56:07barrysetassignee: tarek -> barry
nosy: barry, hoel, tarek, eric.araujo
2011-02-10 17:46:05pitrousetversions: + Python 3.1, Python 3.2
nosy: + barry, eric.araujo, tarek

assignee: tarek
components: + Distutils, Distutils2, - Installation
stage: patch review
2011-02-10 13:47:45hoelcreate