sage -python

129 views
Skip to first unread message

Ralf Hemmecke

unread,
Jul 10, 2026, 5:06:45 AMJul 10
to sage-devel
I've just installed sage from the git repository by following the steps
at https://github.com/sagemath/sage . That is basically

make configure
./configure --prefix=... --disable-editable ...
make

That succeeds and I can use it, but I wonder why I cannot start

sage -python

For that it tells me:
===========================
usage: sage [-h] [-v] [-q] [--simple-prompt] [-V] [-n
[{jupyter,jupyterlab}]] [-c [COMMAND]] [file ...]
sage: error: unrecognized arguments: -python
===========================

Did I something wrong with the installation?
How can I get back "sage -python".

In fact I need it for a shell script with (after doing some environment
changes) calling

cat $1 \
| sage -python -c "import sys;\
from sage.repl.preparse import preparse_file;\
print(preparse_file(sys.stdin.read()));" \
| ( echo 'from sage.all import *'; cat - ) \
| sage -python \

in order to pass a command to sage and catching the output.

Thanks in advance.
Ralf

Antonio Rojas

unread,
Jul 10, 2026, 5:31:14 AMJul 10
to sage-devel
You're running the 'sage' python entry point, 'sage -python' only works with the bash script. Run './sage' instead, or prepend the location of the 'sage' bash script to your PATH

Ralf Hemmecke

unread,
Jul 10, 2026, 5:47:59 AMJul 10
to sage-...@googlegroups.com
On 7/10/26 11:31, Antonio Rojas wrote:
> You're running the 'sage' python entry point, 'sage -python' only works
> with the bash script. Run './sage' instead, or prepend the location of the
> 'sage' bash script to your PATH

Well, I installed it with --prefix=$HOME/sage/install. Under this
install directory there it starts bin/sage which **is** a shell script
with the following content.

============================================
#!/home/hemmecke/sage/install/bin/python3
import sys
from sage.cli.__main__ import main
if __name__ == '__main__':
sys.argv[0] = sys.argv[0].removesuffix('.exe')
sys.exit(main())
============================================

Are you saying, that I should simply call without the -python argument?

Or am I supposed to dig out the old sage shell script from the git repo?

Ralf

Antonio Rojas

unread,
Jul 10, 2026, 6:09:48 AMJul 10
to sage-devel
El viernes, 10 de julio de 2026 a las 11:47:59 UTC+2, Ralf Hemmecke escribió:
Are you saying, that I should simply call without the -python argument?

Or am I supposed to dig out the old sage shell script from the git repo?


The script should be in your sage source dir (where you ran 'make' from).  The one in your install dir is the python entry point, which doesn't support the `-python` argument.

Ralf Hemmecke

unread,
Jul 10, 2026, 6:28:34 AMJul 10
to sage-...@googlegroups.com
Oh, it really seems that I simply can call the "sage" script from within
the git repo.

I find that a bit strage, since I read that with "configure
--disable-editable" I could actually delete the sources.
It is probably true, but if I have to take care on the shell scripts
separately, then this statement about deleting the sources is a bit
misleading.

Thank you anyway. At least you pointed me to a solution.

Ralf

Dima Pasechnik

unread,
Jul 10, 2026, 9:02:14 AMJul 10
to sage-...@googlegroups.com
Try --python, not -python ?

Ralf Hemmecke

unread,
Jul 10, 2026, 9:52:58 AMJul 10
to sage-...@googlegroups.com
On 7/10/26 14:45, Dima Pasechnik wrote:
> Try --python, not -python ?

Doesn't work either.

One has to use the script from the sources.

But my directory is like

$HOME/sage/sage (git-repo)
$HOME/sage/install (used in ./configure --prefix)

Under "install" there is no script that allows --python.

Ralf

Dima Pasechnik

unread,
Jul 10, 2026, 4:52:50 PMJul 10
to sage-...@googlegroups.com, Ralf Hemmecke
and that's the way it has always been.
The following works

$ ./sage --python
Python 3.13.13 (main, Apr 25 2026, 14:20:31) [GCC 15.2.1 20260214] on linux
Type "help", "copyright", "credits" or "license" for more information.

If you set your PATH so that "sage" is not the same as "./sage" then
all the bets are off.

Dima

>
> Ralf
>
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/sage-devel/529fc69b-5a37-4a10-8c3f-8d99385c5f26%40gmail.com.

Nils Bruin

unread,
Jul 11, 2026, 10:11:47 AMJul 11
to sage-devel
It sounds to me that it would be reasonable to expect that "installing" sage in a different location from where it is built would also install the main entry point: the "sage" script that lives in the root of the sage install. Would it be reasonable to put a copy in "<sage_root>/local/bin" ? Presently it's not there. I'd assume that with a non-editable install, the files in "local/bin" would make it to the installed location and that there's a clear directory there that should be (added to)/(present in) the PATH.

Is there a particular reason why that script doesn't (also?) live in "local/bin"?

Dima Pasechnik

unread,
Jul 12, 2026, 10:23:43 AMJul 12
to sage-...@googlegroups.com
our ./sage is an omnibus edition, so to speak, while distros want to remove some options, so they basically cook their own sage scripts, as far as I know.

Antonio Rojas

unread,
Jul 12, 2026, 12:23:41 PMJul 12
to sage-devel
The "main" entry point for a user install of sage is the python one, which only supports the simple user facing options. The full, development oriented options (including the redundant ones such as -python, which is just a shortcut for the python command) are only available in the source bash script. See https://github.com/sagemath/sage/pull/39015 for the discussion on which options the user-facing launcher should support.
Reply all
Reply to author
Forward
0 new messages