Ask Your Question

About Document "Environment variables used by Sage"

asked 2016-06-20 11:36:31 -0600

danny gravatar image

updated 2016-06-20 11:39:09 -0600

In these environment variables mentioned in sage document "Environment variables used by Sage", "DOT_SAGE" is the only one valid variable in Sagemath 7.2. The document should be updated.

BTW, the init.sage script still do not work. Is there a way to setup start up script in jupyter notebook for sage kernel?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2016-06-21 15:24:46 -0600

I disagree with your assertion that DOT_SAGE is the only valid variable listed here. All but one of the listed variables are still valid, most used by either local/bin/sage-env or by src/sage/

  • DOT_SAGE: yes, see both sage-env and
  • SAGE_RC_FILE: yes, see sage-env
  • SAGE_STARTUP_FILE: yes, see both sage-env and
  • SAGE_SERVER: yes, but only used when downloading packages: see build/sage_bootstrap/
  • SAGE_PATH: yes, see sage-env
  • SAGE_BROWSER: yes, see src/misc/; I think it also gets used by the old Sage notebook
  • SAGE_CBLAS: I'm not sure about this one; it may not be valid anymore.

See also for environment variables used when compiling Sage.

edit flag offensive delete link more


Thanks for your answer. I mean that those variables can not be called directly in sage notebook except DOT_SAGE. In my answer above, I have said that the variable is available by variable SAGE_ENV, which is set in sage-env.

danny gravatar imagedanny ( 2016-06-21 18:29:00 -0600 )edit

They are not intended to be "called directly". They are environment variables, which means that if they are set, they are accessible from Python via os.environ['DOT_SAGE'], etc. The variable SAGE_ENV carries some of the same information, some different information. Most of the settings in SAGE_ENV are not meant to be customized directly, whereas you are welcome to change the value of SAGE_STARTUP_FILE (for example) in your shell.

John Palmieri gravatar imageJohn Palmieri ( 2016-06-21 22:00:24 -0600 )edit

answered 2016-06-21 11:18:32 -0600

danny gravatar image

I find that many environment variables are stored in variable SAGE_ENV. For the question of start up script, the init.sage file do work in command line mode, and not work for sage notebook. For Jupyter notebook, we can setup start up script in the following way:

In [1]: profile = get_ipython().profile_dir.location
In [2]: %%writefile $profile/startup/start.ipy
          ...some codes you want to run...

Note: the codes are executed for python2 kernel and sagemath kernel

edit flag offensive delete link more

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


Asked: 2016-06-20 11:36:31 -0600

Seen: 91 times

Last updated: Jun 21 '16