Opened 4 months ago

Closed 3 months ago

Last modified 3 months ago

#28660 closed enhancement (fixed)

Make Python 3 the default

Reported by: vdelecroix Owned by:
Priority: major Milestone: sage-9.0
Component: misc Keywords:
Cc: tmonteil Merged in:
Authors: Frédéric Chapoton Reviewers: John Palmieri, Eric Gourgoulhon
Report Upstream: N/A Work issues:
Branch: 715e85a (Commits) Commit:
Dependencies: #28657 Stopgaps:

Description

Because 3 x 3 = 9 and we are at 9.0.beta3 these are three reasons to do the switch... see

https://groups.google.com/forum/#!topic/sage-devel/fmQbbSctZ-I

Change History (42)

comment:1 Changed 4 months ago by chapoton

  • Branch set to public/python3_switch
  • Commit set to c9646f95724b8b21b958ff37e024cd06076e0280

No idea how to do that properly. Any volunteer to do the job ?


New commits:

c9646f9py3 switch : some changes in doc only

comment:2 Changed 4 months ago by chapoton

Some of the involved stuff:

  • SAGE_PYTHON_VERSION
  • SAGE_PYTHON3
  • --with-python
  • WITH_PYTHON

comment:4 Changed 4 months ago by git

  • Commit changed from c9646f95724b8b21b958ff37e024cd06076e0280 to 4357742da6c81172f029afc6dd9dee14d964a25f

Branch pushed to git repo; I updated commit sha1. New commits:

4357742python3 switch : change in configure.ac

comment:5 Changed 4 months ago by chapoton

ok, I did that. Anything else ?

comment:6 Changed 4 months ago by dimpase

  • Dependencies set to #25837

I think it depends on #25837, as sagenb doesn't work with Python 3.

comment:7 Changed 4 months ago by chapoton

Did you test ? Sagenb is already automatically put aside (i.e. not built) with python3.

comment:8 Changed 4 months ago by dimpase

well, this is OK as an experimental feature, but we do install all the standard packages, normally speaking, and sagenb is standard. Besides, with Python 3 the message on https://github.com/vbraun/ExportSageNB/pull/16/commits is unclear (it does not say that Sage must be built with Python 2 for sagenb to function)

comment:9 Changed 4 months ago by git

  • Commit changed from 4357742da6c81172f029afc6dd9dee14d964a25f to ad6e2f9be044162ef6fd049c9b7fa609305af351

Branch pushed to git repo; I updated commit sha1. New commits:

ad6e2f9py3 switch more doc changes

comment:11 Changed 4 months ago by jhpalmieri

  • Dependencies changed from #25837 to #25837 #28657

If a prerequisite for building from source becomes "Python >= 3.6", then we need #28657 as a dependency.

comment:12 follow-ups: Changed 4 months ago by jhpalmieri

In my opinion, #25837 is a hybrid ticket: one part should be simple — make sagenb optional, perhaps with a better error message, as in comment:10. The other part is to add to Jupyter some functionality which sagenb has but Jupyter does not. I am willing to sacrifice the second of these goals (for now) in order to make the switch to Python 3.

comment:13 in reply to: ↑ 12 Changed 4 months ago by egourgoulhon

Replying to jhpalmieri:

In my opinion, #25837 is a hybrid ticket: one part should be simple — make sagenb optional, perhaps with a better error message, as in comment:10. The other part is to add to Jupyter some functionality which sagenb has but Jupyter does not. I am willing to sacrifice the second of these goals (for now) in order to make the switch to Python 3.

+1

comment:14 Changed 4 months ago by git

  • Commit changed from ad6e2f9be044162ef6fd049c9b7fa609305af351 to 1b42e43d66eaa49bbd1b93c8028ea8cd8d2e514e

Branch pushed to git repo; I updated commit sha1. New commits:

1b42e43py3 switch more details

comment:15 Changed 4 months ago by git

  • Commit changed from 1b42e43d66eaa49bbd1b93c8028ea8cd8d2e514e to 3efeee96da36641bbd1e3ec254e31b6e8f3cc875

Branch pushed to git repo; I updated commit sha1. New commits:

3efeee9py3 swithc more details

comment:16 follow-up: Changed 4 months ago by chapoton

May I remove the dependency to #25837 ?

comment:17 in reply to: ↑ 16 ; follow-up: Changed 4 months ago by jhpalmieri

Replying to chapoton:

May I remove the dependency to #25837 ?

I certainly think so.

comment:18 Changed 4 months ago by jhpalmieri

And #28657 doesn't need to be a dependency for this ticket, as long as it remains a blocker for the next release.

Last edited 4 months ago by jhpalmieri (previous) (diff)

comment:19 Changed 4 months ago by jhpalmieri

I tried this and it works: after running make, I see

configure:7614: checking Python version to install
configure:7631: result: 3

comment:20 in reply to: ↑ 17 Changed 4 months ago by dimpase

Replying to jhpalmieri:

Replying to chapoton:

May I remove the dependency to #25837 ?

I certainly think so.

how about making sagenb opional on this branch then?

comment:21 Changed 4 months ago by git

  • Commit changed from 3efeee96da36641bbd1e3ec254e31b6e8f3cc875 to 715e85a64b821188ee7123a62255ee22868882c3

Branch pushed to git repo; I updated commit sha1. New commits:

715e85amake sagenb optional

comment:22 Changed 4 months ago by chapoton

  • Dependencies changed from #25837 #28657 to #28657

ok, we can turn sagenb to optional here if you prefer.

comment:23 Changed 4 months ago by tmonteil

  • Cc tmonteil added

comment:24 follow-up: Changed 4 months ago by chapoton

Please edit and enhance the wiki page about the switch https://wiki.sagemath.org/Python3-Switch

comment:25 in reply to: ↑ 24 Changed 4 months ago by vdelecroix

Replying to chapoton:

Please edit and enhance the wiki page about the switch https://wiki.sagemath.org/Python3-Switch

I would have thought that url link with space in them would better be avoided. You created a page Python3-compatible code. Am I allowed to fix that? I also open a page for end users who will suffer much more the transition than developers.

comment:26 Changed 4 months ago by chapoton

  • Authors set to Frédéric Chapoton
  • Status changed from new to needs_review

something else ? We should try to move forward.

comment:27 Changed 4 months ago by jhpalmieri

As I said before, it works for me. Anyone else with feedback?

comment:28 Changed 4 months ago by egourgoulhon

Builds like a charm on Ubuntu 18.04 running on a i7-6700HQ + 16 GB RAM computer: having merged this ticket branch in Sage 9.0.beta4 sources (from a fresh git clone + pull develop), running MAKE="make -j8" make yielded a fully working Python3 Sage. In particular sage -python gives

Python 3.7.3 (default, Nov  4 2019, 17:58:44) 
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

comment:29 Changed 4 months ago by jhpalmieri

  • Reviewers set to John Palmieri, Eric Gourgoulhon
  • Status changed from needs_review to positive_review

comment:30 Changed 4 months ago by jhpalmieri

Let's proceed with this.

comment:31 Changed 4 months ago by gh-mwageringel

This works for me as well on CentOS.

comment:32 in reply to: ↑ 12 Changed 4 months ago by kcrisman

In my opinion, #25837 is a hybrid ticket: one part should be simple — make sagenb optional, perhaps with a better error message, as in comment:10. The other part is to add to Jupyter some functionality which sagenb has but Jupyter does not. I am willing to sacrifice the second of these goals (for now) in order to make the switch to Python 3.

"For now" are dangerous words, though, in particular regarding matrix input and automatic_names. I'm certainly glad that both 3d viewers seem to work in Jupyter now, though I haven't yet built with py3 support.

comment:33 Changed 4 months ago by jhpalmieri

The switch to Python 3 needs to happen. To get these issues fixed, people need to work on them, and if no one is working on them (as seems to be the case), that isn't reason enough to delay the switch to Python 3.

comment:34 Changed 3 months ago by vbraun

  • Branch changed from public/python3_switch to 715e85a64b821188ee7123a62255ee22868882c3
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:35 Changed 3 months ago by jhpalmieri

  • Commit 715e85a64b821188ee7123a62255ee22868882c3 deleted

See #28742 for a followup: after building with Python 2 and then upgrading to a version of Sage including this ticket, the version of Python changes to 3. This causes problems, so we should detect the version mismatch and either keep using Python 2 or abort the make process, telling the user what the issue is.

comment:36 Changed 3 months ago by jhpalmieri

Even though sagenb is now optional, it is still always installed because it is a dependency for building the documentation. Look at line 4 in the following, from build/make/deps:

# Building the documentation has many dependencies, because all
# documented modules are imported and because we use matplotlib to
# produce plots.
DOC_DEPENDENCIES = sagelib $(inst_sphinx) $(inst_sagenb) \
	| $(SAGERUNTIME) $(inst_maxima) $(inst_networkx) $(inst_scipy) $(inst_sympy) \
	$(inst_matplotlib) $(inst_pillow) $(inst_mathjax) $(inst_mpmath) \
	$(inst_ipykernel) $(inst_jupyter_client) $(inst_conway_polynomials) \
	$(inst_tachyon) $(inst_jmol) $(inst_thebe) $(inst_ipywidgets) $(inst_typing)

Should we create another followup to deal with this? I can do it, but it may take me a few days, because I have other higher priority things I have to do first.

comment:37 Changed 3 months ago by fbissey

Definitely need a follow up. We disentangled that bit a while ago now. I can take care of it, if that's the only place we need to fix for this.

comment:38 Changed 3 months ago by fbissey

It is now #28805.

comment:39 Changed 3 months ago by jhpalmieri

Thanks.

comment:40 Changed 3 months ago by jhpalmieri

Should we delete the file src/ext/doctest/python3-known-passing.txt and the corresponding parts of Makefile?

comment:41 Changed 3 months ago by dimpase

yes, sure, let's do this.

comment:42 Changed 3 months ago by jhpalmieri

I opened #28835.

Note: See TracTickets for help on using tickets.