Ask Your Question
2

Differences between Python2 Sagemath and Python3 Sagemath?

asked 2018-07-11 21:35:20 +0100

number123 gravatar image

With sagemath looking to move away from python2 in 2020 and as a new user of sagemath, I wanted to know what the differences are between Python2 Sagemath and Python3 Sagemath?

At the moment sagemath is not fully compatible with python3 and I have been told to expect problems. I want to know how serious these problems are and how frequent they are. I would then be able to know if using python3 sagemath is worth the trouble.

edit retag flag offensive close merge delete

Comments

In the future there will likely be benefits. I could see major benefits, for example, from the use of function annotations, the matmul operator, and things like that. But until Sage drops Python 2 support there won't be any major features that rely on Python 3 most likely.

Iguananaut gravatar imageIguananaut ( 2018-07-12 14:19:26 +0100 )edit

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

slelievre gravatar imageslelievre ( 2018-10-08 17:56:31 +0100 )edit

2 Answers

Sort by » oldest newest most voted
4

answered 2018-07-12 11:38:58 +0100

slelievre gravatar image

This answer might soon become obsolete, so let me emphasise that it is written on 2018-07-12.

Porting Sage to Python 3 is work in progress.

As far as I know, a Python3-based Sage currently has no extra functionality.

Using it is a sign of enthusiasm for the development of Sage.

The casual user is expected to stick to Python2-based Sage for now.

Running make test, make testlong, make ptest, make ptestlong is a way to check whether all the examples and tests in Sage's documentation work as expected. So far, these will not succeed with a Python3-based Sage; they will help developers know what still needs to be worked on for porting Sage to Python3.

To learn more about the doctesting framework in Sage, read:

For more about Sage and Python3, see other questions tagged Python3.x on Ask Sage.

edit flag offensive delete link more

Comments

@slelievre thanks for finally clarifying what make ptest actually does. Previously I assumed that my python3 sage was failing make ptest only due to the documentation failing to build properly when using python3. Now I understand that it actually runs examples from different areas in mathematics. This means that if my use cases are calculus, vector calculus, ODES, algebra, Linear Algebra, Geometry and probability then using sage built with python3 will most likely not work adequately for some of these cases or even all.

number123 gravatar imagenumber123 ( 2018-07-12 12:45:34 +0100 )edit
3

answered 2018-07-12 07:08:35 +0100

The most reliable way to use Sage right now is with its default Python 2. Before it moves to Python 3, all of the problems will have to be worked out. How frequently you will run into problems, and how serious those problems will be, depends on what you want to do. If you run Sage's doctests, you will see lots of failures, but there are also lots of successes. Running the doctests is one good way to see where there are problems. Just using Sage is another.

This is the best answer that I can give unless you specify how you plan to use Sage — graph theory? simplicial complexes? calculus? something else — and unless you quantify, or at least clarify, what you mean by "worth the trouble".

edit flag offensive delete link more

Comments

Yes I already encountered failures referencing docs when running make ptest for sagemath compiled with python3. Can you confirm what failing the doctests means? I assume it means that I would have to look for documentation on the sagemath website instead.

I plan to use sage for calculus and vector calculus, ODES, algebra, Linear Algebra, Geometry. By worth the trouble I mean that do the gains from using sagemath python3 out weigh the problems one might encounter. For example, if the only issue is lack of an integrated documentation, then I would say using sagemath python 3 is worth the trouble (if it has better functionality) because I could always find documentation on the official sagemath website.

number123 gravatar imagenumber123 ( 2018-07-12 11:09:20 +0100 )edit
1

At this point, the only reasons to use Python 3 with Sage are: because you have a compelling reason to use Python 3 syntax rather than Python 2, and/or because you want to help make Sage compatible with Python 3. I don't know of any particular "better functionality" with Sage + Python 3.

John Palmieri gravatar imageJohn Palmieri ( 2018-07-12 17:09:42 +0100 )edit

I deleted python3 sage and restarted with python2, now I am getting a different error when running tests with SAGE_CHECK=yes.

number123 gravatar imagenumber123 ( 2018-07-12 17:41:11 +0100 )edit

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: 2018-07-11 21:35:20 +0100

Seen: 1,661 times

Last updated: Jul 12 '18