Ask Your Question
0

Can't find SAGE_ROOT

asked 2022-10-15 00:08:09 +0200

Agnishom gravatar image

I want to install jsliacan/flagmatic-w (from GitHub) but it seems that my SAGE_ROOT variable is not defined.

agnishom@agnishomDuncan:~$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.5, Release Date: 2022-01-30                     │
│ Using Python 3.10.6. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
sage: SAGE_ROOT
sage:
Exiting Sage (CPU time 0m0.07s, Wall time 0m4.03s).

Also,

agnishom@agnishomDuncan:~$ echo $SAGE_ROOT

The result seems to be blank. How do I set this variable?

edit retag flag offensive close merge delete

Comments

How did you install Sage? What is your OS?

John Palmieri gravatar imageJohn Palmieri ( 2022-10-15 22:14:03 +0200 )edit

I am on Ubuntu. I do not remember how I installed Sage. Through apt-get most likely

chlamydomonas gravatar imagechlamydomonas ( 2022-10-16 04:49:19 +0200 )edit

4 Answers

Sort by » oldest newest most voted
0

answered 2022-10-22 18:46:07 +0200

slelievre gravatar image

It seems you want to install csdp using sage -i.

Your operating system's package manager might have it packaged.

In Debian or Ubuntu, use the following command in a terminal:

sudo apt install coinor-csdp
edit flag offensive delete link more
0

answered 2022-10-17 23:37:40 +0200

updated 2022-10-17 23:38:09 +0200

I think you're talking about https://github.com/jsliacan/flagmatic. The first instruction there is sage -i csdp, and this fails for me with Sage installed by apton Ubuntu. The only safe way to do this, and in my experience, the only reliable way to be able to build other packages for Sage, is to build Sage from scratch, but fortunately that is not too complicated. Follow the directions at https://doc.sagemath.org/html/en/inst..., and in particular at https://doc.sagemath.org/html/en/inst.... (I recommend all four of the sudo apt-get install ... commands given there.)

edit flag offensive delete link more

Comments

It is possible that building from condamight also work: https://doc.sagemath.org/html/en/inst...

John Palmieri gravatar imageJohn Palmieri ( 2022-10-17 23:39:01 +0200 )edit
0

answered 2022-10-15 18:40:39 +0200

Emmanuel Charpentier gravatar image

This is normal. the sage executable is a shell script which defines some environment variables (among them SAGE_ROOT) then launches Sage's version of Python with the necessary libraries.

Similarly, sage -sh lauvhes the same shell script, whose argument sh launches a subshell where SAGE_ROOT is defined (among others, most notably the path).

The Python session implementing the Sage REPL doesn't need a SAGE_ROOT identifier, but it is defined in the underlying environment :

charpent@zen-book-flip:~$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.8.beta1, Release Date: 2022-09-29               │
│ Using Python 3.10.7. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: !echo $SAGE_ROOT
/usr/local/sage-9
sage: quit
charpent@zen-book-flip:~$ echo $SAGE_ROOT

HTH,

edit flag offensive delete link more

Comments

I'm not sure it's normal that SAGE_ROOT returns nothing when Sage is running.

John Palmieri gravatar imageJohn Palmieri ( 2022-10-15 22:13:35 +0200 )edit

@John Palmieri : Indeed...

On 9.8.beta1, I get :

sage: SAGE_ROOT
'/usr/local/sage-9'

I ignored the existence of this built-in identifier... ;-)

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2022-10-15 22:50:42 +0200 )edit

That didn't help:

agnishom@agnishomDuncan:~$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.5, Release Date: 2022-01-30                     │
│ Using Python 3.10.6. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘

sage: !echo $SAGE_ROOT
None
chlamydomonas gravatar imagechlamydomonas ( 2022-10-16 04:48:13 +0200 )edit

For context, I want to have SAGE_ROOT set, because the install script of a package wants it: https://github.com/jsliacan/flagmatic...

chlamydomonas gravatar imagechlamydomonas ( 2022-10-16 04:51:48 +0200 )edit
0

answered 2022-10-15 18:37:46 +0200

Max Alekseyev gravatar image

Running export SAGE_ROOT=/usr/local/sage-9.6 (or alike) will make this variable available for the current shell session and descendant processes.

edit flag offensive delete link more

Comments

I do not know where my sage is installed. How do I find out?

chlamydomonas gravatar imagechlamydomonas ( 2022-10-16 04:48:42 +0200 )edit

Run which sage in the shell.

Max Alekseyev gravatar imageMax Alekseyev ( 2022-10-16 13:16:24 +0200 )edit

It didn't help much

``` agnishom@agnishomDuncan:~$ which sage

/usr/bin/sage ```

chlamydomonas gravatar imagechlamydomonas ( 2022-10-16 15:47:41 +0200 )edit

Look inside this sage script via less /usr/bin/sage

Max Alekseyev gravatar imageMax Alekseyev ( 2022-10-16 19:34:32 +0200 )edit

What should I look for in this script?

chlamydomonas gravatar imagechlamydomonas ( 2022-10-19 05:29:24 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-10-15 00:08:09 +0200

Seen: 1,992 times

Last updated: Oct 22 '22