Ask Your Question
1

Is it possible to update the Sage Python?

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

cybervigilante gravatar image

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

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

Comments

Not yet. Sage is on track to switch to Python 3 - see e.g. https://trac.sagemath.org/ticket/15980

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

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

python-future.org/imports.html

docs.python.org/3/library/__future__.html

...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 -0600 )edit

1 answer

Sort by » oldest newest most voted
2

answered 2018-10-09 09:00:19 -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

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

Stats

Asked: 2017-04-05 16:13:53 -0600

Seen: 162 times

Last updated: Oct 09