Opened 6 years ago

Closed 6 years ago

#22775 closed defect (fixed)

conway_polynomials not compatible with python3

Reported by: Frédéric Chapoton Owned by:
Priority: major Milestone: sage-8.0
Component: python3 Keywords:
Cc: Jeroen Demeyer, Volker Braun, John Palmieri, Jean-Pierre Flori, Peter Bruin Merged in:
Authors: Frédéric Chapoton Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 339a49d (Commits, GitHub, GitLab) Commit: 339a49d64e447cbf00ae89ff736b1dfc3605d6b4
Dependencies: Stopgaps:

Status badges

Description (last modified by Frédéric Chapoton)

The package conway_polynomials does not compile with SAGE_PYTHON3=yes.

Let us use pickle instead of sage own save-and-load.

[conway_polynomials-0.4.p0] Thread model: posix
[conway_polynomials-0.4.p0] gcc version 5.4.0 (GCC) 
[conway_polynomials-0.4.p0] ****************************************************
[conway_polynomials-0.4.p0] Traceback (most recent call last):
[conway_polynomials-0.4.p0]   File "./spkg-install", line 4, in <module>
[conway_polynomials-0.4.p0]     from sage.structure.sage_object import save
[conway_polynomials-0.4.p0] ImportError: No module named 'sage.structure.sage_object'
[conway_polynomials-0.4.p0]

Tarball: https://trac.sagemath.org/raw-attachment/ticket/22775/conway_polynomials-0.5.tar.bz2

Attachments (1)

conway_polynomials-0.5.tar.bz2 (215.3 KB) - added by Frédéric Chapoton 6 years ago.

Download all attachments as: .zip

Change History (21)

comment:1 Changed 6 years ago by Frédéric Chapoton

Cc: Jeroen Demeyer added
Component: PLEASE CHANGEpython3
Type: PLEASE CHANGEdefect

comment:2 Changed 6 years ago by Frédéric Chapoton

Potentially the same problem with database_odlyzko_zeta ?

conway_polynomials/spkg-install:from sage.structure.sage_object import save
conway_polynomials/spkg-install:from sage.env import SAGE_SHARE
database_odlyzko_zeta/spkg-install:from sage.all import save
database_odlyzko_zeta/spkg-install:from sage.env import SAGE_SHARE
database_odlyzko_zeta/spkg-install:from sage.misc.misc import sage_makedirs

comment:3 Changed 6 years ago by Frédéric Chapoton

@jdemeyer, do you have any idea of what to do here ? This is my current blocking point.

comment:4 Changed 6 years ago by Frédéric Chapoton

Cc: Volker Braun jhpalmeri added

and sage (with python3) itself fails to launch because of the line

---> 39 from sage.structure.sage_object import SageObject

in sage/repl/rich_output/display_manager.py

comment:5 Changed 6 years ago by Volker Braun

conway_polynomials depends on sagelib, so the latter has be become inport-able into python3 first.

Arguably this is a bad state of affairs, conway_polynomials should just use some Sage-independent format to serialize itself (e.g. plain Python pickles / sqlite / ...).

comment:6 Changed 6 years ago by Frédéric Chapoton

Thanks, Volker. I do not think I will be able to fix that..

By the way, trying to import sage in my python3-sage build, I get

./sage -python
Python 3.5.1 (default, Apr 16 2017, 11:35:45) 
[GCC 6.2.0 20161005] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sage.all import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/chapoton/sage3/local/lib/python3.5/site-packages/sage/all.py", line 86, in <module>
    import sage.misc.lazy_import
ImportError: No module named 'sage.misc.lazy_import'

So it seems that there is some problem with the cython extensions..

comment:7 Changed 6 years ago by Frédéric Chapoton

Branch: public/experimental_python3_v0
Commit: 18bd95dc50ddbb69e80824a8d92d5f03b6f3f2f7

here is my current experimental branch, where all pyx files compile with SAGE_PYTHON3=yes


Last 10 new commits:

e55ac1btrac 22756: fix merge error with #22764.
7699f3ftrac 22756: check name of _scproxy .so file correctly for Python 3.
dcc3fb4trac 22756: remove two invalid configure options for Python 3
678fb20trac 22756: port a fix for pyports.h from
6762fe4trac 22756: rebase better on top of 22764
ab246fdMerge branch 'u/jhpalmieri/python3_osx' of ssh://trac.sagemath.org:22/sage into test
02a2b13py3.6 compatible weak dictionaries
787975etrac 22305 adding the new weak_dict.pyx
39c189dMerge branch 'public/22305' of ssh://trac.sagemath.org:22/sage into test
18bd95dVERY experimental python3 branch

comment:8 Changed 6 years ago by git

Commit: 18bd95dc50ddbb69e80824a8d92d5f03b6f3f2f7b13a9e1cf18f3456e00323e087e35104ec4123c6

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

8722eb7trac 22305 typo
b13a9e1Merge branch 'public/22305' of ssh://trac.sagemath.org:22/sage into test

comment:9 Changed 6 years ago by Frédéric Chapoton

Cc: Jean-Pierre Flori Peter Bruin added

comment:10 Changed 6 years ago by Frédéric Chapoton

Branch: public/experimental_python3_v0u/chapoton/conway_pickle
Commit: b13a9e1cf18f3456e00323e087e35104ec4123c62a7197dbf419288dcb27bad78a8d3e41b623d8b6

here is a tentative, not yet tested, to use pickle


New commits:

2a7197dtrying to make conway package sage-independent

comment:11 Changed 6 years ago by git

Commit: 2a7197dbf419288dcb27bad78a8d3e41b623d8b6467e4e147c8b18e4cc671af87d6df2f33181a7dd

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

467e4e1trac 22775 fixing details

comment:12 Changed 6 years ago by Frédéric Chapoton

Description: modified (diff)
Status: newneeds_review

this seems to work

comment:13 Changed 6 years ago by Frédéric Chapoton

But fails on python3 with

[conway_polynomials-0.4.p1] gcc version 6.2.0 20161005 (Ubuntu 6.2.0-5ubuntu12) 
[conway_polynomials-0.4.p1] ****************************************************
[conway_polynomials-0.4.p1] Traceback (most recent call last):
[conway_polynomials-0.4.p1]   File "./spkg-install", line 22, in <module>
[conway_polynomials-0.4.p1]     create_db()
[conway_polynomials-0.4.p1]   File "./spkg-install", line 11, in create_db
[conway_polynomials-0.4.p1]     from src import conway_polynomials
[conway_polynomials-0.4.p1]   File "/home/chapoton/sage3/local/var/tmp/sage/build/conway_polynomials-0.4.p1/src/__init__.py", line 1, in <module>
[conway_polynomials-0.4.p1]     from table import *
[conway_polynomials-0.4.p1] ImportError: No module named 'table'
[conway_polynomials-0.4.p1] 
[conway_polynomials-0.4.p1] real	0m0.177s
[conway_polynomials-0.4.p1] user	0m0.056s
[conway_polynomials-0.4.p1] sys	0m0.024s
[conway_polynomials-0.4.p1] ************************************************************************
[conway_polynomials-0.4.p1] Error installing package conway_polynomials-0.4.p1

comment:14 Changed 6 years ago by Travis Scrimshaw

From the error, looks like a relative import that will needs to be an absolute import. You probably should also fix this from src import conway_polynomials in spkg-install too.

Changed 6 years ago by Frédéric Chapoton

comment:15 Changed 6 years ago by git

Commit: 467e4e147c8b18e4cc671af87d6df2f33181a7dd339a49d64e447cbf00ae89ff736b1dfc3605d6b4

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

339a49dnew version of conway polynomial package

comment:16 Changed 6 years ago by Travis Scrimshaw

Authors: Frédéric Chapoton
Reviewers: Travis Scrimshaw

Works for me with Python2. If you tested it with Python3, then set a positive review.

comment:17 Changed 6 years ago by Frédéric Chapoton

Status: needs_reviewpositive_review

works for me in python3 (so that, for the first time ever, I got the message "Sage build/upgrade complete!" with python3 !!)

comment:18 Changed 6 years ago by Frédéric Chapoton

Description: modified (diff)

comment:19 Changed 6 years ago by John Palmieri

Cc: John Palmieri added; jhpalmeri removed

comment:20 Changed 6 years ago by Volker Braun

Branch: u/chapoton/conway_pickle339a49d64e447cbf00ae89ff736b1dfc3605d6b4
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.