Import sage python module

i like this post (click again to cancel)
2
i dont like this post (click again to cancel)

Hi!

I've been trying to setup sagemath in order to use the sage python module by importing it in an other python project. I'm trying to get the same thing that i get when calling:

./sage -python

Is there a deployment script/python egg that install the module in dist-package? Is there a folder i can add to my python path?

So far I downloaded the "sage-4.6-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux.tar.lzma" version and unpacked it to "/opt/sage" while changing sure to update the "SAGE_ROOT" in /opt/sage.

I know there must be a way to do so because FAQ mentions it. Python 2.6 is already bundled with my machine so i guess all I have to do is add a folder to my python path?

asked Dec 19 '10

charettes gravatar image charettes
33 1 2 7

2 Answers:

i like this answer (click again to cancel)
2
i dont like this answer (click again to cancel) charettes has selected this answer as correct

I don't think that this is really possible at present - an mostly uninformed guess is that anything relying on an spkg or external programs would break. If you want to try it anyway, maybe set SAGE_ROOT as devel/sage/build/ (since that's the built version of the code).

There's a thread on sage-devel that might be useful.

link

posted Dec 21 '10

Felix Lawrence gravatar image Felix Lawrence
594 7 10 17
1
A better location for the built version is SAGE_ROOT/local/lib/python/site-libraries/sage. Adding SAGE_ROOT/local/lib/python/site-libraries to your PYTHON_PATH helps, but doesn't fix the problem altogether. John Palmieri (Dec 21 '10)
Thank you very much i'll have a look at this thread :) charettes (Jan 02 '11)
i like this answer (click again to cancel)
1
i dont like this answer (click again to cancel)

I tried "cd" to SAGE_ROOT/devel/sage did the following.

Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ['SAGE_ROOT'] = '/opt/sage'
>>> from sage.all import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sage/all.py", line 56, in <module>
    from sage.rings.memory import pmem_malloc
ImportError: No module named memory

I'm stuck to this, any idea why i get this error while running sage from the console and netbook works fine?

link

posted Dec 20 '10

charettes gravatar image charettes
33 1 2 7

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
Login/Signup to Post

Question tools

Tags:

Stats:

Asked: Dec 19 '10

Seen: 1,265 times

Last updated: Dec 21 '10

powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.