Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am getting the following weird permission denied problem in python and this is happening whenever I login (SSH) as a normal user (means not root):

Traceback (most recent call last):
  File "/usr/lib/python2.7/", line 562, in <module>
  File "/usr/lib/python2.7/", line 544, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/lib/python2.7/", line 271, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/lib/python2.7/", line 246, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/lib/python2.7/", line 236, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/lib/python2.7/", line 543, in get_config_var
    return get_config_vars().get(name)
  File "/usr/lib/python2.7/", line 442, in get_config_vars
  File "/usr/lib/python2.7/", line 321, in _init_posix
    raise IOError(msg)
IOError: invalid Python installation: unable to open /usr/include/python2.7/pyconfig.h (Permission denied)

The permission to /usr/include/python2.7/pyconfig.h reads like:

-rw-r--r-- 1 root root 35884 2011-10-04 17:24 /usr/include/python2.7/pyconfig.h

Not sure what is causing this problem, BTW, I know there are similar question to this problem (link1 and link2) but those are with respect to "No file or directory".

share|improve this question
up vote 2 down vote accepted

Permissions are ok, but I'm afraid if you need to open it as normal user you'll have to change them. Now it has 644 (-rw-r--r--), so I'd try to set it 645 (-rw-r--r-x):

sudo chmod 645 /usr/include/python2.7/pyconfig.h
share|improve this answer
this worked like a charm. Thanks a bunch. – RakeshS Jun 15 '12 at 5:29

Your Answer


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.