First time here? Check out the FAQ!

Ask Your Question
1

About Document "Environment variables used by Sage"

asked 8 years ago

danny gravatar image

updated 8 years ago

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?

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
2

answered 8 years ago

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

Preview: (hide)
link
2

answered 8 years ago

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/env.py:

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

See also http://doc.sagemath.org/html/en/insta... for environment variables used when compiling Sage.

Preview: (hide)
link

Comments

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 ( 8 years ago )

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 ( 8 years ago )

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: 8 years ago

Seen: 918 times

Last updated: Jun 21 '16