On Thursday, January 10, 2019 at 9:58:56 AM UTC-6, E. Madison Bray wrote: > > > On archlinux that also uses system Python for Sage the > > situation is better: importing sage.all in Python2 does work! Even > > though the configuration constants are not in the environment! They > > are set up properly in sage_env.py that is part of the SageMath > > installation. And more precisely $SAGE_LOCAL fallsback to the default > > "/usr" which is what it is intend to be on archlinux. > > > > I don't understand why on Debian $SAGE_LOCAL is set to None and > > managed by environment variables. > > I have mentioned elsewhere (e.g. on > https://trac.sagemath.org/ticket/22652) that the sage.env module ought > to be fixed upstream (that is, in the main Sage sources) so that it > can actually work properly without having to set any special > environment variables. Even if it has to guess in some cases, and has > to raise a RuntimeError if it can't reasonably guess the correct > values for some variables, in most cases it should be possible to > design this in such a way that it *just works* from a normal python > interpreter with no additional variables set. >
Fixing upstream is always best, but in the meantime is there some reason that the Debian package doesn't just patch "sage/env.py" like Arch does? Looking at the Arch approach, I checked that the following 3-line patch causes 'python -c "import sage.all"' to succeed on Debian Sid with SageMath 8.4. Best, Nathan --- env.py.orig 2019-01-03 05:15:59.000000000 -0600 +++ env.py 2019-01-10 12:28:13.000000000 -0600 @@ -118,10 +118,10 @@ _add_variable_or_fallback('LOCAL_IDENTIFIER','$HOSTNAME.%s'%os.getpid()) # bunch of sage directories and files -_add_variable_or_fallback('SAGE_ROOT', None) -_add_variable_or_fallback('SAGE_LOCAL', None) +_add_variable_or_fallback('SAGE_ROOT', '/usr/share/sagemath') +_add_variable_or_fallback('SAGE_LOCAL', '/usr') _add_variable_or_fallback('SAGE_ETC', opj('$SAGE_LOCAL', 'etc')) -_add_variable_or_fallback('SAGE_SCRIPTS_DIR',opj('$SAGE_LOCAL', 'bin')) +_add_variable_or_fallback('SAGE_SCRIPTS_DIR',opj('$SAGE_ROOT', 'bin')) _add_variable_or_fallback('SAGE_INC', opj('$SAGE_LOCAL', 'include')) _add_variable_or_fallback('SAGE_SHARE', opj('$SAGE_LOCAL', 'share')) -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.