Ask Your Question

Using a python 3 class in SageMath

asked 2016-11-14 03:41:16 -0500

Erel Segal-Halevi gravatar image

I wrote a class that uses some python 3 features (specifically, functools.lru_cache).

When I try to import it into my SageMath notebook, I get errors, since the notebook runs on Python 2.7.

I read in this FAQ: that the answer to the question "Can I use Sage with Python 3.x?" is: "Currently, no. Sage depends on the SciPy stack of Python numerical and scientific packages. As of 2010, SciPy still uses Python 2.x. So until SciPy is ported to run with Python 3.x and Cython supports Python 3.x, Sage will continue to use Python 2.x."

But, this answer is from 2010. Now it's 2016, and SciPy already supports Python 3.

So, my questions are: * Is it possible now to use SageMath with Python 3 * If not, is there a workaround I can use to import my class to SageMath notebook?

edit retag flag offensive close merge delete


kcrisman gravatar imagekcrisman ( 2016-11-14 05:59:38 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2016-11-14 08:20:18 -0500

The FAQ item you are quoting is indeed obsolete, and should be updated, since both SciPy and Cython now support Python 3.

Efforts towards support for Python 3 are under way and tracked at Sage trac ticket #15530 as indicated by @kcrisman.

The topic comes up with some frequency on the sage-devel mailing list and the conclusion of a 2016-05 sage-devel discussion was that we should aim to support both Python 2 and Python 3 for a while.

In a 2016-10 sage-devel discussion it was pointed out that switching to Python 3 would improve Sage's startup time, and Frédéric Chapoton called for more volunteers to work on the transition to 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


Asked: 2016-11-14 03:41:16 -0500

Seen: 276 times

Last updated: Nov 14 '16