Ask Your Question

How to change the prefix to SAGE_TMP?

asked 2015-03-13 23:42:18 +0100

ikol gravatar image

updated 2015-03-13 23:43:56 +0100

SAGE_TMP looks something like this by default: /tmp/tmpGMP2PR. My /tmp is full but I have plenty of space in a different tmp directory on another disk. How can I change the default prefix in SAGE_TMP from /tmp to, say, /raid/scratch?


edit retag flag offensive close merge delete


Which version of Sage are you using? For me the temporary directory is in home/.sage/temp/... This is what you can see from

sage: from sage.misc.misc import SAGE_TMP
sage: SAGE_TMP

On the other hand, if you are using the Sage notebook it does also uses some temporary directory which is I guess in /tmp/ by default.

vdelecroix gravatar imagevdelecroix ( 2015-03-14 09:56:46 +0100 )edit

I am using v6.4.1.~/.sage/temp/ is different. If I run a Notebook session, its files are stored under ~/.sage/notebook/... but while a Sage calculation is running all the files there are just links to /tmp/something where /tmp/something is the value of SAGE_TMP in that session. I am saving large objects via the save() command and that's where I have the problem, because they can't fit in /tmp. There has got to be a way in Sage to set the prefix for SAGE_TMP from /tmp to something else.

ikol gravatar imageikol ( 2015-03-17 17:33:14 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-12-10 05:30:32 +0100

William Stein2 gravatar image

There is no way to customize just SAGE_TMP, though you can customize ~/.sage by setting DOT_SAGE. You can see from the source code at that SAGE_TMP is hardcoded as a function of the hostname and pid. I vaguely recall writing this code 13 years ago to avoid conflicts when running multiple copies of Sage. It seems pretty annoying now, and it could easily lead to ~/.sage/temp getting really big if Sage keeps crashing, whereas often /tmp on systems gets automatically cleaned up (at least on reboot). Also, /tmp is often on a much faster filesystem than ~/.sage (which might be mounted over NFS). Sigh. I hope somebody changes this.

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: 2015-03-13 23:42:18 +0100

Seen: 633 times

Last updated: Dec 10 '19