Ask Your Question

Updating Sage to python 3.8 or 3.9

asked 2021-02-26 16:29:04 +0100

Alain Ngalani gravatar image

updated 2021-03-06 10:07:27 +0100

FrédéricC gravatar image

I'm running an alogorithm that seems to work in sagecell but doesn't work in my version of Sage.

I think that maybe this has to do with the fact my version of Sage uses Python 3.7.7, in the last 2 days I tried everything I could to upgrade the Python version but nothing seems to work.

Also I find quite odd that it installs Python 3.7.7 given how on the release notes of Sage 9.2 it states that the program comes with its own copy of python 3.8.5.

Do you know how can I solve?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2021-02-26 16:42:38 +0100

Sébastien gravatar image

updated 2021-03-01 13:53:09 +0100

According to the documentation, during the compilation of SageMath "by default, Sage will try to use system’s python3". In your case, it finds the Python 3.7.7.

Did you compile SageMath from source? If yes, you may force the usage of the Python which is shipped with SageMath instead of the one found on the system by doing:

make configure
./configure --without-system-python3
MAKE='make -j8' make

Or, you may force the usage of some version of python on your system by using instead:

make configure
./configure --with-python=/usr/bin/python3.8
MAKE='make -j8' make

...assuming your Python 3.8 is at this place:

$ which python3.8
edit flag offensive delete link more


I compiled form binary

Alain Ngalani gravatar imageAlain Ngalani ( 2021-02-26 17:10:04 +0100 )edit

Exactly which binary did you install?

John Palmieri gravatar imageJohn Palmieri ( 2021-02-26 18:52:18 +0100 )edit

I tried with 6.2 (sage 9.2), 6.1 (sage 9.2) and 6 (sage 9). No difference but in the fact that installing sage 9 it comes with Python 3.7.3 so even older

Alain Ngalani gravatar imageAlain Ngalani ( 2021-02-26 19:06:29 +0100 )edit

I don't know what "6.2" (etc.) means. Can you tell us the precise name of the binary file that you downloaded? Or at least tell us what operating system you're using?

John Palmieri gravatar imageJohn Palmieri ( 2021-02-27 18:50:02 +0100 )edit

In any case, the easiest way to use a particular version of Python is to make sure that version of Python is installed on your system, and then build Sage from scratch.

John Palmieri gravatar imageJohn Palmieri ( 2021-02-27 18:50:52 +0100 )edit

answered 2021-02-26 16:45:13 +0100

Emmanuel Charpentier gravatar image

Python 3.9 is supported by Sage 9.2, which comes indeed with some version of 3.8 (this is what is used when Sage can't find (or instructed to ignore) a suitable systemwide Python).

The upgrade to 3.9.1 was accepted 5 weeks ago (i. e. 9.3.betasomething), and an effort is underway to upgrade this to Python 9.2 (this ticket currently needs_review : you are welcome to contribute a test on your configuration...).

What leads you to the conclusion that the Python version is responsible for your difficulties ?

edit flag offensive delete link more


The fact that a given code works in sageCell but not on the version of sage I've in my pc.

Also I have both Python 3.8.8 and 3.9.something on my system but still it uses 3.7.7

Alain Ngalani gravatar imageAlain Ngalani ( 2021-02-26 17:03:59 +0100 )edit

Maybe you can just uninstall python 3.7 from your system?

Max Alekseyev gravatar imageMax Alekseyev ( 2021-02-26 18:33:19 +0100 )edit

It doesn't seem to work, I removed every version (and checked by console that there was indeed none), then installed a new version (3.8.8.) but still nothing

Alain Ngalani gravatar imageAlain Ngalani ( 2021-02-27 14:40:31 +0100 )edit

Did you rebuild Sage after this Python cleanup ?

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2021-02-28 09:44:41 +0100 )edit

I tried reinstalling it and even download again. I also tried building from source but I'unabke to, I try typing the comants into windows prompt and nothing happens that should happen

Alain Ngalani gravatar imageAlain Ngalani ( 2021-02-28 14:16:34 +0100 )edit

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: 2021-02-26 16:29:04 +0100

Seen: 1,984 times

Last updated: Mar 06 '21