On Thu, Jan 10, 2019 at 1:57 PM Vincent Delecroix
<20100.delecr...@gmail.com> wrote:
>
> (side note)
>
> 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.



> Le 10/01/2019 à 04:47, Nathan Dunfield a écrit :
> > I am a developer of the Python package "snappy" which acquires extra
> > features when imported inside of Sage. Some of our Linux users have
> > recently reported difficulties with SnapPy on machines where Sage was
> > installed by the standard package manger making use of the system libraries
> > and in particular the system python.  I have reproduced the problem on
> > Debian Sid but it also manifests itself on Fedora 28 [1].  The root of our
> > problem is that in this situation:
> >
> > python -c "import sage.all"
> >
> > results the error:
> >
> > Traceback (most recent call last):
> >    File "<string>", line 1, in <module>
> >    File "/usr/lib/python2.7/dist-packages/sage/all.py", line 71, in <module>
> >      from sage.env import SAGE_ROOT, SAGE_SRC, SAGE_DOC_SRC, SAGE_LOCAL,
> > DOT_SAGE, SAGE_ENV
> >    File "/usr/lib/python2.7/dist-packages/sage/env.py", line 123, in 
> > <module>
> >      _add_variable_or_fallback('SAGE_ETC',        opj('$SAGE_LOCAL', 'etc'))
> >    File "/usr/lib/python2.7/dist-packages/sage/env.py", line 103, in
> > _add_variable_or_fallback
> >      value = sep.join(components)
> > TypeError: sequence item 0: expected string, NoneType found
> >
> > whereas
> >
> > sage -python -c "import sage.all"
> >
> > works as expected.  Currently, our Python package tests for whether it is
> > running in SageMath by:
> >
> > _within_sage = False
> > try:
> >      import sage.all
> >      _within_sage = True
> > except ImportError:
> >      pass
> >
> > One solution for us (I think) would be to simply catch and ignore all types
> > of exceptions in the above block, but I was wondering if the current
> > behavior of 'python -c "import sage.all"' was expected or is this possibly
> > a bug?  Or perhaps there is a work-around of some kind?
> >
> > Thanks,
> >
> > Nathan
> >
> > P.S. In the Debian package "sage" does not accept the "-pip" flag, even
> > though installing the "sagemath" package does pull in "pip" (tested on a
> > clear Sid Docker container).  Why is this?  I ask because our current
> > instructions for installing SnapPy into SageMath use "sage -pip".
> >
> >
> > [1] See the second comment, not the original report, on
> > https://bitbucket.org/t3m/snappy/issues/14/
> >
>
> --
> 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.

-- 
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.

Reply via email to