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.

-- 
John


On Friday, May 19, 2017 at 11:09:40 PM UTC-7, Frédéric Chapoton wrote:
>
> There are many files in src/bin with the first line being "#!/usr/bin/env 
> python"
>
> Should we convert all of them to cal sage-python23 or only a few critical 
> ones ?
>
>
> Le samedi 20 mai 2017 07:59:34 UTC+2, Frédéric Chapoton a écrit :
>>
>> Thanks, John, for the helping hand.
>>
>> Yes, this unicode error will be the next one we need to handle. But first 
>> we need to understand what is going wrong before. Commenting the line in 
>> src/setup.py is certainly not the right solution..
>>
>>
>> Le samedi 20 mai 2017 00:43:25 UTC+2, John H Palmieri a écrit :
>>>
>>>
>>>
>>> On Friday, May 19, 2017 at 3:27:54 PM UTC-7, John H Palmieri wrote:
>>>>
>>>>
>>>>
>>>> On Friday, May 19, 2017 at 2:46:15 PM UTC-7, John H Palmieri wrote:
>>>>>
>>>>>
>>>>>
>>>>> On Friday, May 19, 2017 at 9:51:46 AM UTC-7, Frédéric Chapoton wrote:
>>>>>>
>>>>>> 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, apply
>>>>>>
>>>>>> https://trac.sagemath.org/ticket/23030 (git pull 
>>>>>> trac u/chapoton/23030)
>>>>>>
>>>>>> and
>>>>>>
>>>>>> https://trac.sagemath.org/ticket/22305 (git pull trac public/22305)
>>>>>>
>>>>>> then export SAGE_PYTHON3=yes
>>>>>>
>>>>>> and make build.
>>>>>>
>>>>>> This should finish succesfully, with the usual message. 
>>>>>>
>>>>>
>>>>> It took me a bit more work. First I had a problem with the Sage 
>>>>> library, which I could fix by applying #23029. Second, conway-polynomials 
>>>>> wouldn't build because it couldn't find six.moves, so I had to change the 
>>>>> spkg-install script to use #!/usr/bin/env sage-python23 instead of 
>>>>> #!/usr/bin/env python. I should also point out that even when the problem 
>>>>> is only in conway-polynomials, the build process keeps rebuilding all of 
>>>>> sagelib, rebuilding all of the extensions. So something is not correctly 
>>>>> detecting that the Sage library files are already built and installed.
>>>>>
>>>>> The docs now don't build, although now I see that you were not 
>>>>> recommending even trying. Anyway, the error is:
>>>>>
>>>>> /Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-8.0.beta7/local/bin/python:
>>>>>  
>>>>> No module named sage_setup
>>>>>
>>>>> I suppose it should be calling python3 or sage-python23 instead. If 
>>>>> we're not worrying about the docs for now, that's fine with me.
>>>>>
>>>>>
>>>>> Anyway, I finally got 'make build' to work and I ran into the same 
>>>>> problem you did. One issue is that sage-ipython is being called, and its 
>>>>> first line is #!/usr/bin/env python, which calls python2. You can change 
>>>>> that to sage-python23 (which calls a version of Python depending on the 
>>>>> setting of SAGE_PYTHON3). When I do that, Sage creates a crash report, 
>>>>> saying 
>>>>>
>>>>> ModuleNotFoundError: No module named 'sage.structure.sage_object'. 
>>>>> Indeed, when I look at local/lib/python3.6/site-packages/sage/structure, 
>>>>> there are no .so files there. This must be related to the issues that 
>>>>> caused constant rebuilding of the Sage library. Here are some lines from 
>>>>> the log file:
>>>>>
>>>>> copying build/lib.macosx-10.9-x86_64-3.6/sage/structure/
>>>>> sage_object.cpython-36m-darwin.so -> 
>>>>> /Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-8.0.beta7/local/lib/python3.6/site-packages/sage/structure
>>>>>
>>>>> and then later
>>>>>
>>>>> Cleaning up stale file: 
>>>>> /Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-8.0.beta7/local/lib/python3.6/site-packages/sage/structure/
>>>>> sage_object.cpython-36m-darwin.so
>>>>>
>>>>> (Why isn't it just called "sage_object.so"?)
>>>>>
>>>>
>>>> The stale file issue has been discussed before: 
>>>> https://groups.google.com/d/msg/sage-devel/W7FotQglFBs/RsnII556AwAJ. 
>>>>
>>>
>>> If I comment out the "self.clean_stale_files()" line from src/setup.py, 
>>> then I still get an error, but one you might expect from Python3: 
>>> "NameError: name 'unicode' is not defined". This comes from 
>>> src/sage/misc/sageinspect.py:
>>>
>>>     if not isinstance(r, string_types):
>>>         return ''
>>>     elif isinstance(r, unicode):
>>>         return r.encode('utf-8', 'ignore')
>>>     else:
>>>         return r
>>>
>>>  
>>>
>>>>  
>>>>
>>>>>
>>>>> -- 
>>>>> John
>>>>>
>>>>>
>>>>>
>>>>>  
>>>>>
>>>>>> Then try ./sage
>>>>>>
>>>>>> For me, this fails with some traceback about not finding 
>>>>>> sage.repl.interpreter. Can someone help to fix that please ?
>>>>>>
>>>>>> Frédéric
>>>>>>
>>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to