ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 21 Nov 2016 21:54:49 +0100Using a python 3 class in SageMathhttps://ask.sagemath.org/question/35564/using-a-python-3-class-in-sagemath/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: http://doc.sagemath.org/html/en/faq/faq-usage.html
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?Mon, 14 Nov 2016 10:41:16 +0100https://ask.sagemath.org/question/35564/using-a-python-3-class-in-sagemath/Comment by kcrisman for <p>I wrote a class that uses some python 3 features (specifically, functools.lru_cache).</p>
<p>When I try to import it into my SageMath notebook, I get errors, since the notebook runs on Python 2.7.</p>
<p>I read in this FAQ: <a href="http://doc.sagemath.org/html/en/faq/faq-usage.html">http://doc.sagemath.org/html/en/faq/f...</a>
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."</p>
<p>But, this answer is from 2010. Now it's 2016, and SciPy already supports Python 3.</p>
<p>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?</p>
https://ask.sagemath.org/question/35564/using-a-python-3-class-in-sagemath/?comment=35565#post-id-35565See https://trac.sagemath.org/ticket/15530Mon, 14 Nov 2016 12:59:38 +0100https://ask.sagemath.org/question/35564/using-a-python-3-class-in-sagemath/?comment=35565#post-id-35565Answer by slelievre for <p>I wrote a class that uses some python 3 features (specifically, functools.lru_cache).</p>
<p>When I try to import it into my SageMath notebook, I get errors, since the notebook runs on Python 2.7.</p>
<p>I read in this FAQ: <a href="http://doc.sagemath.org/html/en/faq/faq-usage.html">http://doc.sagemath.org/html/en/faq/f...</a>
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."</p>
<p>But, this answer is from 2010. Now it's 2016, and SciPy already supports Python 3.</p>
<p>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?</p>
https://ask.sagemath.org/question/35564/using-a-python-3-class-in-sagemath/?answer=35567#post-id-35567The 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](https://trac.sagemath.org/ticket/15530)
as indicated by @kcrisman.
The topic comes up with some frequency on
[the sage-devel mailing list](https://groups.google.com/forum/#!forum/sage-devel)
and the conclusion of a
[2016-05 sage-devel discussion](https://groups.google.com/d/topic/sage-devel/DrMJtNQid6s/discussion)
was that we should aim to support both Python 2 and Python 3 for a while.
In a [2016-10 sage-devel discussion](https://groups.google.com/d/topic/sage-devel/Wmfptu5Le9I/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.Mon, 14 Nov 2016 15:20:18 +0100https://ask.sagemath.org/question/35564/using-a-python-3-class-in-sagemath/?answer=35567#post-id-35567Comment by FrédéricC for <p>The FAQ item you are quoting is indeed obsolete, and should be updated,
since both SciPy and Cython now support Python 3.</p>
<p>Efforts towards support for Python 3 are under way and tracked at
<a href="https://trac.sagemath.org/ticket/15530">Sage trac ticket #15530</a>
as indicated by <a href="/users/41/kcrisman/">@kcrisman</a>.</p>
<p>The topic comes up with some frequency on
<a href="https://groups.google.com/forum/#!forum/sage-devel">the sage-devel mailing list</a>
and the conclusion of a
<a href="https://groups.google.com/d/topic/sage-devel/DrMJtNQid6s/discussion">2016-05 sage-devel discussion</a>
was that we should aim to support both Python 2 and Python 3 for a while.</p>
<p>In a <a href="https://groups.google.com/d/topic/sage-devel/Wmfptu5Le9I/discussion">2016-10 sage-devel discussion</a>
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.</p>
https://ask.sagemath.org/question/35564/using-a-python-3-class-in-sagemath/?comment=35676#post-id-35676see https://trac.sagemath.org/ticket/21921Mon, 21 Nov 2016 21:54:49 +0100https://ask.sagemath.org/question/35564/using-a-python-3-class-in-sagemath/?comment=35676#post-id-35676