import astropy in a sage notebook v
Hi Sagesse!
I'm wondering if there's an easy way to get a sage notebook (v8.7) to import the module astropy which is found /usr/lib/python3/dist-packages/astropy/ on my linux system.
I am guessing it would require doing an export SAGE_PATH= xxx and then a launch of my notebook as sage --notebook in the usual fashion .
Right now I have the problem :
importError Traceback (most recent call last) <ipython-input-1-7c3762fa282d> in <module>() 1 JD_ecl = RealNumber('2460059.34') 2 Period = RealNumber('1.195') ----> 3 from astropy.time import Time 4 times = ['1999-01-01T00:00:00.123456789', '2010-01-01T00:00:00'] 5 t = Time(times, format='isot', scale='utc')
*ImportError: No module named astropy.time*
and when I check my path in the notebook, it references a directories in my sagepath which in fact don't exist at this point. But maybe I can put a symlink there ....
Example:
import sys print(sys.path) ['', '/home/patricia/SageMath/local/lib/python27.zip', '/home/patricia/SageMath/local/lib/python2.7', '/home/patricia/SageMath/local/lib/python2.7/plat-linux2', '/home/patricia/SageMath/local/lib/python2.7/lib-tk', '/home/patricia/SageMath/local/lib/python2.7/lib-old', '/home/patricia/SageMath/local/lib/python2.7/lib-dynload', '/home/patricia/SageMath/local/lib/python2.7/site-packages', '/home/patricia/SageMath/local/lib/python2.7/site-packages/IPython/extensions', '/home/patricia/.sage/ipython-5.0.0']
Qu'en pensez-vous ?
Any particular reason you're using a version of Sage that's over four years old? Try
sage -pip install astropy
to install the package into Sage's python. Since Sage 8.7 is based on Python 2, the latestastropy
you could use seems to be2.0.16
, which is quite outdated (all the more reason to upgrade).To convert old sws notebooks to ipynb, there used to be the command
but it seems broken in recent versions of SageMath: on my computer running SageMath 10.1, it returns
AttributeError: 'ExportSageNBHandler' object has no attribute '_notebook'
.