Ask Your Question

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

asked 2016-06-22 12:52:59 -0600

petRUShka gravatar image

updated 2016-06-22 13:55:29 -0600

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 02:09:07 -0600 )edit

2 answers

Sort by » oldest newest most voted

answered 2018-10-09 09:01:51 -0600

slelievre gravatar image

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 build
$ make

(instead of just make).

Running make build should complete without errors; running make might give some errors if the documentation cannot be built yet with Python 3.

Regardless of whether the documentation was able to be built, you can use the version of Sage compiled for Python 3, and explore what works and what doesn't yet.

William Stein also just made it very easy to test the latest development release of Sage built with Python 3:

edit flag offensive delete link more


You should not use "make" for the moment.

FrédéricC gravatar imageFrédéricC ( 2018-10-09 11:05:08 -0600 )edit

answered 2018-10-09 10:42:13 -0600

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 12:52:59 -0600

Seen: 212 times

Last updated: Oct 09