ImportError: No module named sage.all

3,044 views
Skip to first unread message

Andrey Abramov

unread,
Jan 27, 2012, 8:13:00 AM1/27/12
to sage-support
Hello, Dear Support team.
I've encountered a problem when importing sage library into a python
script. PATH and LD_LIBRARY_PATH variables are set. And I have no idea
how to solve this issue.
Could you help me, please?

hexxy@hexxy-PC:/var/www/codes/codetables$ echo $PATH
/usr/local/sage:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/
bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
hexxy@hexxy-PC:/var/www/codes/codetables$ echo $LD_LIBRARY_PATH
/usr/local/sage/local/lib
hexxy@hexxy-PC:/var/www/codes/codetables$ python2.6 gen_pol_other.py
Traceback (most recent call last):
File "gen_pol_other.py", line 7, in <module>
from sage.all import *
ImportError: No module named sage.all

Interactive shell works fine as you can see:

hexxy@hexxy-PC:/var/www/codes/codetables$ sage
----------------------------------------------------------------------
| Sage Version 4.7.2, Release Date: 2011-10-29 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage:

Simon King

unread,
Jan 28, 2012, 4:30:18 AM1/28/12
to sage-support
Hi Andrey,

On 27 Jan., 14:13, Andrey Abramov <hex...@gmail.com> wrote:
> hexxy@hexxy-PC:/var/www/codes/codetables$ python2.6 gen_pol_other.py

Let me guess: python2.6 is some system-wide installation of Python,
right?

Sage has its own Python, and I guess that your system-wide python2.6
simply has nothing to do with Sage.

Sage's Python should of course know about sage.all. Does it work if
you do (on the command line)
sage -python gen_pol_other.py
?
Explanation: By "sage -python", you obtain Sage's Python. Similarly,
you can have system-wide installations of GAP, Singular,
Mercurial, ... separate from Sage, but if you can explicitly obtain
the versions provided by Sage with "sage -gap", "sage -singular",
"sage -hg", and so on.

Cheers,
Simon

Andrey Abramov

unread,
Jan 30, 2012, 9:37:27 AM1/30/12
to sage-support
Hello, Simon,
thanks a lot for your reply!

On Jan 28, 1:30 pm, Simon King <simon.k...@uni-jena.de> wrote:

Hi Andrey,

On 27 Jan., 14:13, Andrey Abramov <hex...@gmail.com> wrote:

> hexxy@hexxy-PC:/var/www/codes/codetables$ python2.6
gen_pol_other.py

Let me guess: python2.6 is some system-wide installation of
Python,
right?

Yeah, it is.

Sage has its own Python, and I guess that your system-wide
python2.6
simply has nothing to do with Sage.

Sage's Python should of course know about sage.all. Does it work
if
you do (on the command line)
sage -python gen_pol_other.py
?

Yep, it works.

But the problem is that i want to use sage as a library with my system
python's installation which has a lot of modules already installed.
Atm, i'm creating a site using django and i'd like to use SAGE there
to perform some computation.
So the question is "is it somehow possible to use sage as a module for
system's python installation or i have to reinstall all my modules for
sage's python?"

Simon King

unread,
Jan 31, 2012, 4:10:18 AM1/31/12
to sage-support
Hi Andrey,

probably other people are able to tell you whether (and how) it is
possible to use a package in one Python version that was installed in
a totally different Python version. I have never tried it, myself. So,
sorry that I can't help you in that point.

On 30 Jan., 15:37, Andrey Abramov <hex...@gmail.com> wrote:
> But the problem is that i want to use sage as a library with my system
> python's installation which has a lot of modules already installed.

One could argue that Sage's Python is likely to have much more
installed than your system Python. So, it seems easier (at least to
me) to install a few more packages into Sage's Python than to install
all packages distributed with Sage into your system Python.

Best regards,
Simon
Reply all
Reply to author
Forward
0 new messages