Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an custom install of python 2.7 /opt/python7.2/ built from source using the following flags: ./configure --prefix=/opt/python-2.7/ --enable-shared and make altinstall; make install on a RHEL 6.2 and RHEL 5.5 with a few 3rd party modules (Numpy, SciPy and all supporting libs) installed in the python site-packages dir.

I have no issues importing these 3rd party packages if I run python with the non root user that I installed them with, nor with root. This is tested by importing numpy and then testing with numpy.test("full") However if I try importing these same packages as a different user I get an error saying that the module doesn't exist.

I have traced the issue down to the site-package permissions set to 700. I can change the sit-packages to -R 755 * and import and numpy and try run the tests but I find that there are now a bunch of python imports that fail, this is also due to the 700 permissions. But when i -R 755 * at /opt/python2.7 ... nothing works

I have looked all over the internet for an answer for the following two questions: 1/ is there a flat that I am missing at python build || python install 2/ what folders can I change to 755 so that these 3rd party modules will run?

Thanks

share|improve this question
    
Please be more specific. Tell the exact paths where everything resides and PYTHONPATH for both users. –  ivan_pozdeev Mar 4 '12 at 4:54
    
install dir for 3rd party packages /opt/python-2.7/lib/python2.7/site-packages/ this dir and everything under it is 600 when I "chmod -R 755 /opt/python-2.7/lib/python2.7/site-packages/" the tests stop working /opt/python-2.7/lib/python2.7/site-packages/scipy /opt/python-2.7/lib/python2.7/site-packages/nose /opt/python-2.7/lib/python2.7/site-packages/numpy –  Jason Mar 5 '12 at 15:43
    
I installed python with: make altinstall and reinstall just numpy, but the same issue. (will not run with a diff user and when i 755 the site-packagers it stops working) –  Jason Mar 5 '12 at 18:54
    
Does the 1st user install packages to /opt/python-2.7/lib/python2.7/site-packages/ as well? Regular users don't have write access there as a rule; the modules are likely put somewhere under the 1st user's home directory. And still, what is PYTHONPATH for both users? BTW use backticks (`) for fixed-width font. –  ivan_pozdeev Mar 5 '12 at 20:02
    
How did you install modules as a non-root user in the 1st place? disutils? setuptools? plain file copy? –  ivan_pozdeev Mar 6 '12 at 18:42
show 5 more comments

1 Answer 1

Testing shows that chown -R 755 /opt/python2.7/ in fact breaks numpy tests. I'd say it's a bug unless they have strong reasons. Quick code check didn't reveal the cause and there's no quick way to find out which files need which permissions. So I suggest to:

1) Change user1's umask with umask 022 (will only apply to current session; to change it permanently, add it to bash configuration files) so it creates files with 644/755 permissions.

2) rm -rf /opt/python2.7 and reinstall python the same way. BTW, "make altinstall" step is redundant.

share|improve this answer
    
Thanks Ivan, in the middle of reinstalling now. thanks as well for the make altinstall –  Jason Mar 9 '12 at 21:23
    
thank you very much Ivan. It is now working. One other note, if using nose to run the tests it is safe to go into the nose dir and -R 755* –  Jason Mar 12 '12 at 14:21
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.