Dear all,We have almost reached the state of vanilla sage building with SAGE_PYTHON3=yes (this does not mean working !). But something seems to go wrong, and I would like help to find and fix the current problem.So, for people that want to do something else than answering polls, you can try the following:In a separate install of sage, on top of 8.0.beta7, applyhttps://trac.sagemath.org/ticket/23030 (git pull trac u/chapoton/23030)andhttps://trac.sagemath.org/ticket/22305 (git pull trac public/22305)then export SAGE_PYTHON3=yesand make build.This should finish succesfully, with the usual message.
In the file src/sage_setup/clean.py, the variable CEXTMOD_EXTS could perhaps be modified from (on OS X) ".so" to ".cpython-36m-darwin.so". That fixes the problem for me, but I'm not what Python code to use to come with "cpython-36m-darwin". Something in distutils?
We do not have a plan for how to *run* Sage using Python3, only for how to build it: set SAGE_PYTHON3=yes. Should there be a separate command, `sage3`, which uses Python3? Or once you build with SAGE_PYTHON3=yes, should everything use Python3 aftewards? (I essentially proposed that at #22582 and did not receive any support for it.) Other options for how to run Sage using Python3? We should decide how we want to do this.
So anyway, with the current situation, we should only change files to use sage-python23 if they are used in the build process, e.g., files in build/bin or in build/pkgs/PKG_NAME/, not files in src/bin.
In the file src/sage_setup/clean.py, the variable CEXTMOD_EXTS could perhaps be modified from (on OS X) ".so" to ".cpython-36m-darwin.so". That fixes the problem for me, but I'm not what Python code to use to come with "cpython-36m-darwin". Something in distutils?
ok, now with 8.0.b8, you can just do"export SAGE_PYTHON3=yes"and then "make build". This should succeed, with no error message.Then try "./sage"
Very surprising that sage starts.. Did you really launch the sage that you just compiled ?
ok, now with 8.0.b8, you can just do"export SAGE_PYTHON3=yes"and then "make build". This should succeed, with no error message.Then try "./sage"This fails with some traceback about not finding sage.repl.interpreter.Once again, can please someone help to fix that ?
The road towards a full python3 sage is still quite long, and my motivation gets weaker, as it seems that not so many people care about that.
incidentally, it would be nice if we could equiv local/bin/ipython with the proper sage-python23 as well. Having a functional shell with an interactive debugger is a much nicer way to debug "import sage.all".
TypeError: __str__ returned non-string (type bytes)
which happens in the Parent stuff for "rings/infinity.py" somewhere. The problem is clear: we end up with some byte string from what should be a "str". I don't know where, though. Do "cdef str" objects coerce into "object" as a "str" or as a "bytes"? Probably the latter ... this could be painful.
On Thursday, May 25, 2017 at 4:40:01 PM UTC-7, Nils Bruin wrote:incidentally, it would be nice if we could equiv local/bin/ipython with the proper sage-python23 as well. Having a functional shell with an interactive debugger is a much nicer way to debug "import sage.all".
This is a design question for which we do not have an answer, or even any real suggestions. Right now, SAGE_PYTHON3=yes is purely for building Sage, not for running it, and maybe long-term it should get replaced with a configure option anyway. Python conventions say that "python" should always mean "Python 2", so if we want to follow those conventions, then local/bin/python should not be sage-python23.
I am a bit surprised you can do that. I have just sent a PR to pynac
a couple of days ago to have it build with python3.
https://github.com/pynac/pynac/pull/248
I have a feeling you still a python2 pynac.
François
On Thursday, May 25, 2017 at 5:07:22 PM UTC-7, John H Palmieri wrote:
On Thursday, May 25, 2017 at 4:40:01 PM UTC-7, Nils Bruin wrote:incidentally, it would be nice if we could equiv local/bin/ipython with the proper sage-python23 as well. Having a functional shell with an interactive debugger is a much nicer way to debug "import sage.all".
This is a design question for which we do not have an answer, or even any real suggestions. Right now, SAGE_PYTHON3=yes is purely for building Sage, not for running it, and maybe long-term it should get replaced with a configure option anyway. Python conventions say that "python" should always mean "Python 2", so if we want to follow those conventions, then local/bin/python should not be sage-python23.
I don't really care at this point. In the ugly_py3 style, it's just a good idea to equip local/bin/ipython with something that allows it to run python3 (so that sage -ipython works on a py3 build). Otherwise, there should be a local/bin/ipython3, and possibly sage -ipython can then select which exec to use. This is not about final design, it's about having the right tools to make an inventory of how badly broken sage/py3 is (and what fixes we might make).
I changed local/bin/ipython on my install, but it didn't show up in my git diff. Perhaps local/bin/ipython isn't tracked?
On Thursday, May 25, 2017 at 5:07:22 PM UTC-7, John H Palmieri wrote:
On Thursday, May 25, 2017 at 4:40:01 PM UTC-7, Nils Bruin wrote:incidentally, it would be nice if we could equiv local/bin/ipython with the proper sage-python23 as well. Having a functional shell with an interactive debugger is a much nicer way to debug "import sage.all".
This is a design question for which we do not have an answer, or even any real suggestions. Right now, SAGE_PYTHON3=yes is purely for building Sage, not for running it, and maybe long-term it should get replaced with a configure option anyway. Python conventions say that "python" should always mean "Python 2", so if we want to follow those conventions, then local/bin/python should not be sage-python23.
I don't really care at this point.
In the ugly_py3 style, it's just a good idea to equip local/bin/ipython with something that allows it to run python3 (so that sage -ipython works on a py3 build). Otherwise, there should be a local/bin/ipython3, and possibly sage -ipython can then select which exec to use. This is not about final design, it's about having the right tools to make an inventory of how badly broken sage/py3 is (and what fixes we might make).
If you build Sage's IPython package with SAGE_PYTHON3=yes, then it will install a script local/bin/ipython3. (Note then that if the sage-location script runs, its function make_scripts_relative will break local/bin/ipython3 because it will replace the #! line, which initially uses Sage's Python3, to a generic /usr/bin/env python. Another broken part to fix.)
On Friday, May 26, 2017 at 7:52:57 AM UTC-7, John H Palmieri wrote:If you build Sage's IPython package with SAGE_PYTHON3=yes, then it will install a script local/bin/ipython3. (Note then that if the sage-location script runs, its function make_scripts_relative will break local/bin/ipython3 because it will replace the #! line, which initially uses Sage's Python3, to a generic /usr/bin/env python. Another broken part to fix.)
Ah, that would explain it.
Note that __hex__ is not used anymore in py3 (calling `hex(obj)` goes
through `obj.__index__()`). What I proposed in cypari2 [1] is to use
Cython macros for py2/py3 changes. That solved all py2/py3 issues we had.
cdef class MyClass(...):
IF PY_MAJOR_VERSION == 2:
def __hex__(self):
...
IF PY_MAJOR_VERSION == 2:
def __oct__(self):
...
IF PY_MAJOR_VERSION == 2:
def __int__(self):
...
IF PY_MAJOR_VERSION == 2:
def __cmp__(self, Gen other):
...
[1] https://github.com/defeo/cypari2/pull/13