ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 28 May 2019 15:11:19 -0500Is it possible to run (may be partially) Sage with Python 3?http://ask.sagemath.org/question/33887/is-it-possible-to-run-may-be-partially-sage-with-python-3/ I want to run sage with python3. I know that it isn't fully ported, but I want to use already ported functionality and hope it cover my needs.
One particular reason is my necessity to use `multiprocessing.pool` with `lambda` function which doesn't work with python 2 and [both workarounds](http://stackoverflow.com/questions/4827432/how-to-let-pool-map-take-a-lambda-function ) seem to not work also.
P.S. I found [third workaround](http://stackoverflow.com/a/37976180/359866) which seems to be working.Wed, 22 Jun 2016 12:52:59 -0500http://ask.sagemath.org/question/33887/is-it-possible-to-run-may-be-partially-sage-with-python-3/Comment by slelievre for <p>I want to run sage with python3. I know that it isn't fully ported, but I want to use already ported functionality and hope it cover my needs.</p>
<p>One particular reason is my necessity to use <code>multiprocessing.pool</code> with <code>lambda</code> function which doesn't work with python 2 and <a href="http://stackoverflow.com/questions/4827432/how-to-let-pool-map-take-a-lambda-function ">both workarounds</a> seem to not work also.</p>
<p>P.S. I found <a href="http://stackoverflow.com/a/37976180/359866">third workaround</a> which seems to be working.</p>
http://ask.sagemath.org/question/33887/is-it-possible-to-run-may-be-partially-sage-with-python-3/?comment=46692#post-id-46692Thanks to @FrédéricC, progress has been steady and Sage with Python 3 now works mostly fine!Tue, 28 May 2019 15:08:56 -0500http://ask.sagemath.org/question/33887/is-it-possible-to-run-may-be-partially-sage-with-python-3/?comment=46692#post-id-46692Comment by FrédéricC for <p>I want to run sage with python3. I know that it isn't fully ported, but I want to use already ported functionality and hope it cover my needs.</p>
<p>One particular reason is my necessity to use <code>multiprocessing.pool</code> with <code>lambda</code> function which doesn't work with python 2 and <a href="http://stackoverflow.com/questions/4827432/how-to-let-pool-map-take-a-lambda-function ">both workarounds</a> seem to not work also.</p>
<p>P.S. I found <a href="http://stackoverflow.com/a/37976180/359866">third workaround</a> which seems to be working.</p>
http://ask.sagemath.org/question/33887/is-it-possible-to-run-may-be-partially-sage-with-python-3/?comment=33891#post-id-33891Answer is no. Progress towards python3 is slow.Thu, 23 Jun 2016 02:09:07 -0500http://ask.sagemath.org/question/33887/is-it-possible-to-run-may-be-partially-sage-with-python-3/?comment=33891#post-id-33891Answer by slelievre for <p>I want to run sage with python3. I know that it isn't fully ported, but I want to use already ported functionality and hope it cover my needs.</p>
<p>One particular reason is my necessity to use <code>multiprocessing.pool</code> with <code>lambda</code> function which doesn't work with python 2 and <a href="http://stackoverflow.com/questions/4827432/how-to-let-pool-map-take-a-lambda-function ">both workarounds</a> seem to not work also.</p>
<p>P.S. I found <a href="http://stackoverflow.com/a/37976180/359866">third workaround</a> which seems to be working.</p>
http://ask.sagemath.org/question/33887/is-it-possible-to-run-may-be-partially-sage-with-python-3/?answer=43885#post-id-43885(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
- [Sage Trac ticket 26212: py3: make all tests pass](https://trac.sagemath.org/ticket/26212)
Note that CoCalc lets you use "Sage Py3" and "Sage development Py3"
in the terminal or in CoCalc's .sagews worksheets or in Jupyter.Tue, 09 Oct 2018 09:01:51 -0500http://ask.sagemath.org/question/33887/is-it-possible-to-run-may-be-partially-sage-with-python-3/?answer=43885#post-id-43885Comment by slelievre for <p>(Edited 2019-05-28 after much progress was made thanks to
<a href="/users/1557/fredericc/">@FrédéricC</a> and a few other developers).</p>
<p>You can download the source for Sage and compile it for Python 3.</p>
<p>For that, change to the directory containing the sources and run</p>
<pre><code>$ make configure
$ ./configure --with-python=3
$ make
</code></pre>
<p>Before the documentation was made to build with Python 3,
it was advised to run <code>make build</code> instead of <code>make</code>,
but this is now fixed.</p>
<p>Making all tests pass is the object of</p>
<ul>
<li><a href="https://trac.sagemath.org/ticket/26212">Sage Trac ticket 26212: py3: make all tests pass</a></li>
</ul>
<p>Note that CoCalc lets you use "Sage Py3" and "Sage development Py3"
in the terminal or in CoCalc's .sagews worksheets or in Jupyter.</p>
http://ask.sagemath.org/question/33887/is-it-possible-to-run-may-be-partially-sage-with-python-3/?comment=46693#post-id-46693To follow progress on the Python 3 front, read the updates @FrédéricC posts on
[sage-devel](https://groups.google.com/forum/#!forum/sage-devel).Tue, 28 May 2019 15:11:19 -0500http://ask.sagemath.org/question/33887/is-it-possible-to-run-may-be-partially-sage-with-python-3/?comment=46693#post-id-46693Answer by nbruin for <p>I want to run sage with python3. I know that it isn't fully ported, but I want to use already ported functionality and hope it cover my needs.</p>
<p>One particular reason is my necessity to use <code>multiprocessing.pool</code> with <code>lambda</code> function which doesn't work with python 2 and <a href="http://stackoverflow.com/questions/4827432/how-to-let-pool-map-take-a-lambda-function ">both workarounds</a> seem to not work also.</p>
<p>P.S. I found <a href="http://stackoverflow.com/a/37976180/359866">third workaround</a> which seems to be working.</p>
http://ask.sagemath.org/question/33887/is-it-possible-to-run-may-be-partially-sage-with-python-3/?answer=43887#post-id-43887There is some old code for wrapping functions in a pickleable jacket:
https://trac.sagemath.org/attachment/ticket/11845/picklefunc.py
and there is code that comes packaged with sage to pickle functions:
sage.misc.fpickle
(the first one goes through some effort to try and pickle closures correctly as well -- something that lambda functions are likely to be. I'm not sure if the second will handle that).
In all cases, beware that while pickle goes through great lengths to be backwards compatible with older versions, this does not at all apply when you pickle code objects. Tue, 09 Oct 2018 10:42:13 -0500http://ask.sagemath.org/question/33887/is-it-possible-to-run-may-be-partially-sage-with-python-3/?answer=43887#post-id-43887