Ask Your Question

Is it possible to run (may be partially) Sage with Python 3?

asked 2016-06-22 19:52:59 +0100

petRUShka gravatar image

updated 2016-06-22 20:55:29 +0100

I want to run sage with python3. I know that it isn't fully ported, but I want to use already ported functionality and hope it cover my needs.

One particular reason is my necessity to use multiprocessing.pool with lambda function which doesn't work with python 2 and both workarounds seem to not work also.

P.S. I found third workaround which seems to be working.

edit retag flag offensive close merge delete


Answer is no. Progress towards python3 is slow.

FrédéricC gravatar imageFrédéricC ( 2016-06-23 09:09:07 +0100 )edit

Thanks to @FrédéricC, progress has been steady and Sage with Python 3 now works mostly fine!

slelievre gravatar imageslelievre ( 2019-05-28 22:08:56 +0100 )edit

3 Answers

Sort by » oldest newest most voted

answered 2020-01-22 08:24:04 +0100

petRUShka gravatar image

updated 2020-01-22 08:24:35 +0100

From now on Sage is officially based on Python 3. Note from official site:

Since version 9.0 released in January 2020, SageMath is using Python 3. For more information, see the Python 3 switch wiki.

edit flag offensive delete link more

answered 2018-10-09 16:01:51 +0100

slelievre gravatar image

updated 2019-05-28 22:07:26 +0100

(Edited 2019-05-28 after much progress was made thanks to @FrédéricC and a few other developers).

You can download the source for Sage and compile it for Python 3.

For that, change to the directory containing the sources and run

$ make configure
$ ./configure --with-python=3
$ make

Before the documentation was made to build with Python 3, it was advised to run make build instead of make, but this is now fixed.

Making all tests pass is the object of

Note that CoCalc lets you use "Sage Py3" and "Sage development Py3" in the terminal or in CoCalc's .sagews worksheets or in Jupyter.

edit flag offensive delete link more


To follow progress on the Python 3 front, read the updates @FrédéricC posts on sage-devel.

slelievre gravatar imageslelievre ( 2019-05-28 22:11:19 +0100 )edit

answered 2018-10-09 17:42:13 +0100

nbruin gravatar image

There is some old code for wrapping functions in a pickleable jacket: and there is code that comes packaged with sage to pickle functions: sage.misc.fpickle (the first one goes through some effort to try and pickle closures correctly as well -- something that lambda functions are likely to be. I'm not sure if the second will handle that). In all cases, beware that while pickle goes through great lengths to be backwards compatible with older versions, this does not at all apply when you pickle code objects.

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: 2016-06-22 19:52:59 +0100

Seen: 2,083 times

Last updated: Jan 22 '20