Ask Your Question
1

Is it possible to update the Sage Python?

asked 8 years ago

cybervigilante gravatar image

updated 8 years ago

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?

Preview: (hide)

Comments

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

kcrisman gravatar imagekcrisman ( 8 years ago )

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 ( 8 years ago )

For reference: since the 9.0 release (1 Jan 2020), SageMath is now based on Python 3.

eric_g gravatar imageeric_g ( 5 years ago )

1 Answer

Sort by » oldest newest most voted
4

answered 6 years ago

slelievre gravatar image

updated 5 years ago

(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.

Preview: (hide)
link

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: 8 years ago

Seen: 1,743 times

Last updated: May 28 '19