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.

Reply via email to