Ask Your Question

Is it possible to update the Sage Python?

asked 2017-04-05 16:13:53 -0500

cybervigilante gravatar image

updated 2017-04-06 00:58:12 -0500

FrédéricC gravatar image

I noticed Sage can run a Python notebook, but it's 2.7 when I'm used to using 3.x. It is possible to update the Python in Sage? Also I'm on Windows so I'm using the Sage Virtualbox appliance, which might make it impossible. But is it possible in a sage native host like Linux?

edit retag flag offensive close merge delete


Not yet. Sage is on track to switch to Python 3 - see e.g.

kcrisman gravatar imagekcrisman ( 2017-04-05 20:04:14 -0500 )edit

A possibility would be to import "things" from the future .

...stack over post....

For instance:

sage: from __future__ import absolute_import, print_function    # , division # but this is ok in sage
sage: type(print)
<type 'builtin_function_or_method'>
sage: print 1,2,3
  File "<ipython-input-117-e0b3713317fc>", line 1
    print Integer(1),Integer(2),Integer(3)
SyntaxError: invalid syntax

sage: print( 1,2,3 )
1 2 3
dan_fulea gravatar imagedan_fulea ( 2017-04-20 15:19:31 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2018-10-09 09:00:19 -0500

slelievre gravatar image

updated 2019-05-28 15:14:27 -0500

(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

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: 2017-04-05 16:13:53 -0500

Seen: 412 times

Last updated: May 28