Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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 ?