Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Whenever I attempt to use an application relating to python2(gnome-tweak-tool, bzr, etc.) it fails to start and, when run from command-line, I get this error:

    [username@host ~]$ gnome-tweak-tool
Traceback (most recent call last):
  File "/usr/lib/python2.7/site.py", line 563, in <module>
    main()
  File "/usr/lib/python2.7/site.py", line 545, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/lib/python2.7/site.py", line 278, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/lib/python2.7/site.py", line 253, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/lib/python2.7/site.py", line 243, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/lib/python2.7/sysconfig.py", line 520, in get_config_var
    return get_config_vars().get(name)
  File "/usr/lib/python2.7/sysconfig.py", line 419, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/usr/lib/python2.7/sysconfig.py", line 287, in _init_posix
    raise IOError(msg)
IOError: invalid Python installation: unable to open /usr/bin/lib/python2.7/config/Makefile (No such file or directory)

I had posted this on askubuntu, but was told it belonged here, since I use Arch Linux. Output for python2:

    [username@host ~]$ python2
Traceback (most recent call last):
  File "/usr/lib/python2.7/site.py", line 563, in <module>
    main()
  File "/usr/lib/python2.7/site.py", line 545, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/lib/python2.7/site.py", line 278, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/lib/python2.7/site.py", line 253, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/lib/python2.7/site.py", line 243, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/lib/python2.7/sysconfig.py", line 520, in get_config_var
    return get_config_vars().get(name)
  File "/usr/lib/python2.7/sysconfig.py", line 419, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/usr/lib/python2.7/sysconfig.py", line 287, in _init_posix
    raise IOError(msg)
IOError: invalid Python installation: unable to open /usr/bin/lib/python2.7/config/Makefile (No such file or directory)
share|improve this question
1  
Strange. Take a look yourself at the output of pacman -Ql python2 and can you post the output of whereis python2? Try pacman -Rs python and then pacman -Syyu python. Maybe you out of sync. –  Herman Torjussen Feb 23 '12 at 21:10

2 Answers 2

up vote 2 down vote accepted

Probably your Python install is messed up: /usr/bin/lib/python2.7/... makes no sense since Python installs its stuff under /usr/lib/python2.7

Try removing the python package and then reinstalling it again.

share|improve this answer
    
I already tried sudo pacman -Rdd python2; sudo pacman -S python2 multiple times. –  fwhiffahder Feb 23 '12 at 20:43
    
Rather strange, then... I don't understand where Python is getting this /usr/bin/lib path from. –  Renan Feb 23 '12 at 20:49
2  
did a sudo mv /usr/bin/lib/python2.7 /usr/bin/lib/python2.7.old and it works! –  fwhiffahder Feb 24 '12 at 22:00

on Ubuntu, I was able to get this to work with

export PYTHONPATH=/usr/lib/pymodules/python2.7:/usr/lib/python2.7

export PYTHONHOME=/usr/lib/python2.7

sudo ln -s /usr/lib /usr/lib/python2.7/lib

sudo ln -s /usr /usr/lib/python2.7/local

There's probably an error in sysconfig.py where it's appending an absolute path on top of another absolute path (ignoring actual system paths and settings), rather than a relpath on top of an abspath

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.