It seems that executing a python script via sage-native-execute can cause problems, because not everything gets reset:
$ sage -sh Starting subshell with Sage environment variables set. Be sure to exit when you are done and do not do anything with other copies of Sage! Bypassing shell configuration files ... > sage-native-execute sh sh-3.2$ python python: error while loading shared libraries: libpython2.6.so.1.0: cannot open shared object file: No such file or directory sh-3.2$ which python /usr/local/sage/4.4.4/local/bin/python sh-3.2$ /usr/bin/python 'import site' failed; use -v for traceback Python 2.4.3 (#1, Jun 11 2009, 14:09:37) [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> sh-3.2$ echo $PYTHONPATH :/usr/local/sage/4.4.4/local/lib/python sh-3.2$ echo $PYTHONHOME /usr/local/sage/4.4.4/local sh-3.2$ unset PYTHONPATH sh-3.2$ unset PYTHONHOME sh-3.2$ /usr/bin/python Python 2.4.3 (#1, Jun 11 2009, 14:09:37) [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> As you can see, executing python as-is doesn't work because /sage/ local/bin is still in the path, so the sage python gets picked up and fails because the library path *has* been reset. Executing the system python instead doesn't work either, because PYTHONPATH and PYTHONHOME still point at the sage python locations. Only by explicitly unsetting those variables and calling the system python by name do I get a fully functional "system" python. It took me quite a while to figure this one out while trying to use magma via the notebook (my magma startup script uses python). If the magma expect interface would run magma without sage-native-execute I'd be OK. Being able to have magma run via sage comes at a great penalty to the portability of my magma startup script. Do people have ideas on how to let sage-native-execute recover a saner environment? Since sage gets removed from the library path, it should probably be removed from PATH as well? Other variables that should probably be removed or reset by sage- native-execute: Variables that retain evidence of sage after sage-native-execute: ECLDIR=/usr/local/sage/4.4.4/local/lib/ecl/ GP_DATA_DIR=/usr/local/sage/4.4.4/local/share/pari GPDOCDIR=/usr/local/sage/4.4.4/local/share/pari/doc GPHELP=/usr/local/sage/4.4.4/local/bin/gphelp LD_LIBRARY_PATH= LIBRARY_PATH=/usr/local/sage/4.4.4/local/lib/ PATH=/usr/local/sage/4.4.4:/usr/local/sage/4.4.4/local/bin: #..... PYTHONHOME=/usr/local/sage/4.4.4/local PYTHONPATH=:/usr/local/sage/4.4.4/local/lib/python SINGULAR_EXECUTABLE=/usr/local/sage/4.4.4/local/bin/Singular SINGULARPATH=/usr/local/sage/4.4.4/local/share/singular (LD_LIBRARY_PATH was unset originally) I'd expect anybody with native installs of ecl, gp, python, singular to be in trouble: even sage-native-execute will still pick up the sage ones due to the path. Furthermore, native version probably don't run because their environment variables are still pointing at their sage relatives. -- To post to this group, send an email to [email protected] To unsubscribe from this group, send an email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
