You are here

python problems

10 posts / 0 new
Last post
python problems
#1

I'm trying to install Rosetta on a Centos system using the comman in rosetta_source/readme.txt:
python external/scons-local/scons.py . I get the error message: ImportError: No module named os

Can someone please shed light on this for me?

Thanks!
Irene Newhouse

Post Situation: 
Fri, 2010-12-10 11:41
einew

"os" is a central Python module. The fact that your python interpreter cannot find it is concerning. What version of python is installed...?

Fri, 2010-12-10 11:47
smlewis

I just upgraded my OS to Centos & the updates are current. In /usr/lib there's a directory python2.4. In /usr/bin there's entries python, python2 & python2.4. Oddly enough, another program, modeller9v8, has no problems with my python installation & runs properly.

Irene

Fri, 2010-12-10 12:37
einew

It's probably a pathing thing. What happens if you write your own python script (hello world is sufficient) and try to import os?

Fri, 2010-12-10 16:07
smlewis

Starting from a basic hello script that does print, when I add import os it fails to import... It does sound like pathing; any recommendations? As I said before, python, python2 [a symbolic link to python] & python2.4 are all in my /usr/bin. The command 'which python' locates all 3 & echoing $PATH includes /usr/bin

Thanks!

Mon, 2010-12-13 11:08
einew

My best recommendation would be try asking general python or centos forums. If it fails on hello world it's clearly not Rosetta, and I'm clearly not an expert on python. (In other words, I'd help if I could, but I can't.)

Mon, 2010-12-13 11:34
smlewis

Thanks, I will.

Mon, 2010-12-13 15:42
einew

Yes, it was a pathing thing. It may be buried deep, deep in the documentation, but no one told me that $PYTHONPATH would be automatically set to an incorrect value by the new OS. Actually, I think the old OS was doing it too, but there were other reasons to change, so that's OK. I figured out the correct setting for PYTHONPATH & now scons.py can import all sorts of modules it couldn't before, like os. HOWEVER it still crashes on "import time". I found that the import calls relate to files in $PYTHONPATH. My version of python is 2.4.3. scons.py calls for 2.4 So the module names SHOULD be compatible. There are no files called time in $PYTHONPATH, nor anywhere else that 'find' can reach. There is a timeit. Does anyone know if these are equivalent? Has anyone managed to bring up rosetta on a Centos box recently?

I've been experimenting with substituting timeit for time, just to see what happens. I found it in 2 places & fixed it, but there's a 3rd call so deep in the scons calling hierarchy I haven't managed to find it yet...

Thanks for any advice!!

Wed, 2010-12-22 13:02
einew

I tracked the "import time" statements right into timeit.py - part of python! I'm off to bug the Centos forum again [the general python forum hasn't been as helpful].

Happy Holidays!

Thu, 2010-12-23 11:05
einew

It turns out that python doesn't need to have PYTHONPATH or PYTHONHOME set, which the OS was doing. With unset commands in my .bashrc, python works properly.

Mon, 2010-12-27 22:21
einew