Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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/site.py", line 562, in <module>
    main()
  File "/usr/lib/python2.7/site.py", line 544, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/lib/python2.7/site.py", line 271, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/lib/python2.7/site.py", line 246, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/lib/python2.7/site.py", line 236, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/lib/python2.7/sysconfig.py", line 543, in get_config_var
    return get_config_vars().get(name)
  File "/usr/lib/python2.7/sysconfig.py", line 442, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/usr/lib/python2.7/sysconfig.py", 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
add comment

1 Answer

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
add comment

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.