-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
3.2's sysconfig doesn't work with virtualenv #54952
Comments
From http://code.google.com/p/virtualenv5/issues/detail?id=6 - it seems that the >> import sysconfig; sysconfig.get_paths('purelib')
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/sysconfig.py", line 332, in _init_posix
_parse_makefile(makefile, vars)
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/sysconfig.py", line 220, in _parse_makefile
with open(filename, errors="surrogateescape") as f:
IOError: [Errno 2] No such file or directory: '/tmp/e/lib/python3.2/config-3.2m/Makefile' |
That does seem to be a regression since distutils.sysconfig works correctly in a virtualenv: $ python3.2 -c 'import distutils.sysconfig;print(distutils.sysconfig.get_makefile_filename())'
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/config-3.2m/Makefile
$ python3.2 -c 'import sysconfig;print(sysconfig.get_makefile_filename())'
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/config-3.2m/Makefile but in a virtualenv: $ source t/bin/activate
$ python3.2 -c 'import distutils.sysconfig;print(distutils.sysconfig.get_makefile_filename())'
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/config-3.2m/Makefile
$ python3.2 -c 'import sysconfig;print(sysconfig.get_makefile_filename())'
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/sysconfig.py", line 332, in _init_posix
_parse_makefile(makefile, vars)
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/sysconfig.py", line 220, in _parse_makefile
with open(filename, errors="surrogateescape") as f:
IOError: [Errno 2] No such file or directory: '/Users/nad/t/lib/python3.2/config-3.2m/Makefile'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/sysconfig.py", line 322, in get_makefile_filename
return os.path.join(get_path('stdlib'),
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/sysconfig.py", line 451, in get_path
return get_paths(scheme, vars, expand)[name]
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/sysconfig.py", line 442, in get_paths
return _expand_vars(scheme, vars)
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/sysconfig.py", line 168, in _expand_vars
_extend_dict(vars, get_config_vars())
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/sysconfig.py", line 487, in get_config_vars
_init_posix(_CONFIG_VARS)
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/sysconfig.py", line 337, in _init_posix
raise IOError(msg) BTW, your example will fail in any case since get_paths takes a scheme name; "purelib" is a path name. |
Setting to deferred blocker for 3.2 release manager evaluation. |
Agreed it should probably be a release blocker. I guess it has to do with (not) following symlinks, right? |
OK, let's make this one. Tarek to the rescue! |
Will do tonight |
I have investigated the problem and it turns out virtualenv patches distutils.sysconfig behavior by adding to the sys module a "real_prefix" attribute that points to the global Python install and is used instead of sys.prefix that points to the virtualenv local install, when some distutils.sysconfig APIs are used. The fix is to change virtualenv so it patches sysconfig the same way it does for distutils.sysconfig. To simulate this patch, just change how _EXEC_PREFIX and _PREFIX are set in sysconfig, by setting them to sys.real_prefix instead of sys.prefix/sys.exec_prefix when using virtualenv. I suggest to Georg that this bug gets resolved to "invalid" and that we move it to the virtualenv bitbucket tracker. |
Sounds good, but this doesn't belong to the virtualenv bug tracker (virtualenv does even support Python 3). Instead, it belongs to the virtualenv5 tracker: http://code.google.com/p/virtualenv5/issues/detail?id=6 |
I think that this issue needs to be reopened... since it never has been resolved... Installation went fine (configure with --prefix=/usr/mysoft/python32)... But when using Python I get the following error message:
Traceback (most recent call last):
File "/usr/mysoft/python32/lib/python3.2/sysconfig.py", line 332, in _init_posix
_parse_makefile(makefile, vars)
File "/usr/mysoft/python32/lib/python3.2/sysconfig.py", line 220, in _parse_makefile
with open(filename, errors="surrogateescape") as f:
IOError: [Errno 2] No such file or directory: 'lib/python3.2/config-3.2m/Makefile'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/mysoft/python32/lib/python3.2/site.py", line 529, in <module>
main()
File "/usr/mysoft/python32/lib/python3.2/site.py", line 517, in main
known_paths = addusersitepackages(known_paths)
File "/usr/mysoft/python32/lib/python3.2/site.py", line 263, in addusersitepackages
user_site = getusersitepackages()
File "/usr/mysoft/python32/lib/python3.2/site.py", line 238, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/usr/mysoft/python32/lib/python3.2/site.py", line 228, in getuserbase
USER_BASE = get_config_var('userbase')
File "/usr/mysoft/python32/lib/python3.2/sysconfig.py", line 590, in get_config_var
return get_config_vars().get(name)
File "/usr/mysoft/python32/lib/python3.2/sysconfig.py", line 487, in get_config_vars
_init_posix(_CONFIG_VARS)
File "/usr/mysoft/python32/lib/python3.2/sysconfig.py", line 337, in _init_posix
raise IOError(msg)
IOError: invalid Python installation: unable to open lib/python3.2/config-3.2m/Makefile (No such file or directory) ... I never heard about virtualenv before and I don't know what is the impact of that library, but I guess a just released version of Python should work out of the box?!? (Final 3.2 release) |
Please find here a small C app embedding python that shows how to reproduce the problem (It turned out that the problem is caused by the new method "Py_SetPath"): #include "Python.h"
main(int argc, char **argv)
{
Py_SetPath(Py_GetPath());
printf("Init\n");
Py_Initialize();
printf("-- END\n");
} --> Python crashes on Py_Initialize... only if the Py_SetPath is executed... |
Le vendredi 25 février 2011 à 13:58 +0000, Palm Kevin a écrit :
Can you open a separate issue? |
Done: bpo-11320 |
On Feb 25, 2011, at 01:16 PM, Palm Kevin wrote:
On Ubuntu 10.10, I built Python 3.2 from the svn head with |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: