sage -python

36 views
Skip to first unread message

Ralf Hemmecke

unread,
5:06 AM (7 hours ago) 5:06 AM
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,
5:31 AM (7 hours ago) 5:31 AM
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,
5:47 AM (6 hours ago) 5:47 AM
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,
6:09 AM (6 hours ago) 6:09 AM
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,
6:28 AM (6 hours ago) 6:28 AM
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,
9:02 AM (3 hours ago) 9:02 AM
to sage-...@googlegroups.com
Try --python, not -python ?

Ralf Hemmecke

unread,
9:52 AM (2 hours ago) 9:52 AM
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

Reply all
Reply to author
Forward
0 new messages