ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 16 Jan 2012 15:50:48 +0100How to import nonstandard python packages in sage nbhttps://ask.sagemath.org/question/8566/how-to-import-nonstandard-python-packages-in-sage-nb/I am trying to import a non-standard python package (particularly, theano) into sage: I can copy the package to the main sage directory to allow me to import it from the command line, but it does not seem to like doing it inside the notebook. For reference, my sage is in /usr/local/sage-4.7.2/, and the package is just a folder inside (with the usual __init__.py).Mon, 16 Jan 2012 14:36:53 +0100https://ask.sagemath.org/question/8566/how-to-import-nonstandard-python-packages-in-sage-nb/Answer by Shashank for <p>I am trying to import a non-standard python package (particularly, theano) into sage: I can copy the package to the main sage directory to allow me to import it from the command line, but it does not seem to like doing it inside the notebook. For reference, my sage is in /usr/local/sage-4.7.2/, and the package is just a folder inside (with the usual __init__.py).</p>
https://ask.sagemath.org/question/8566/how-to-import-nonstandard-python-packages-in-sage-nb/?answer=13127#post-id-13127Start the notebook with following lines and replace path-to-module and module-name with whatever is appropriate in you case.
import sys
sys.path.append('path-to-module')
import module-nameMon, 16 Jan 2012 15:50:48 +0100https://ask.sagemath.org/question/8566/how-to-import-nonstandard-python-packages-in-sage-nb/?answer=13127#post-id-13127