3-manifolds / SnapPy

SnapPy is a package for studying the topology and geometry of 3-manifolds, with a focus on hyperbolic structures. It is based on the SnapPea kernel written by Jeff Weeks.
https://snappy.computop.org/
84 stars 39 forks source link

Cannot compile in Sagemath 9.8beta7 in Fedora 37 #88

Closed enriqueartal closed 1 year ago

enriqueartal commented 1 year ago

I got error with make snappy in Sagemath 9.8beta7, with python3-3.1.11:

[snappy]       
error: Command "gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Ikernel/headers -Ikernel/unix_kit -Ikernel/addl_code -Ikernel/real_type -I/usr/local/sage-310/local/var/lib/sage/venv-python3.11/include -I/usr/include/python3.11 -c cython/SnapPy.c -o build/temp.linux-x86_64-cpython-311/cython/SnapPy.o" failed with exit status 1
NathanDunfield commented 1 year ago

Thanks for the report. Could you upload a complete log of the output prior to the error? We'll need more to go on to figure this out.

enriqueartal commented 1 year ago

snappy.log

Here is the log; I tried also with the git version; would that log also useful?

enriqueartal commented 1 year ago

It seems to be independent of sagemath, essentially the same error happens with pip, both with 3.0.3 or the from github repo

NathanDunfield commented 1 year ago

What version of Cython do you have? Since Python 3.11 is relatively new, you need a recent Cython to be able to build snappy.

enriqueartal commented 1 year ago

The version is 0.29.32, last one in Fedora 37

NathanDunfield commented 1 year ago

Thanks for the clarification. Your error messages look a lot like these from https://github.com/cython/cython/issues/4500. But that issue was fixed in https://github.com/cython/cython/pull/4584 and we have successfully built SnapPy with Cython 0.29.32 and Python 3.11 on Linux, namely the pypa docker image.

Does the below wheel work for you? That might be the easiest solution here:

snappy-3.1rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.gz

enriqueartal commented 1 year ago

I tried to install the above file (after gunzip) via pip install name_of_the_file I got a similar error:

gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Iplanarity_src/c/ -I/usr/include/python3.11 -c planarity_src/c/stack.c -o build/temp.linux-x86_64-cpython-311/planarity_src/c/stack.o
      gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Iplanarity_src/c/ -I/usr/include/python3.11 -c planarity_src/planarity.c -o build/temp.linux-x86_64-cpython-311/planarity_src/planarity.o
      planarity_src/planarity.c:216:12: error fatal: longintrepr.h: No existe el fichero o el directorio
        216 |   #include "longintrepr.h"

Nevertheless I found /usr/include/python3.11/cpython/longintrepr.h in my system.

NathanDunfield commented 1 year ago

That error is from it trying to build the dependency spherogram from the source tarball (no compilation will is needed to install the snappy wheel itself) on pypi. That tarball includes Cython-generated C code that is incompatible with Python 3.11. I think you need to clone https://github.com/3-manifolds/Spherogram and then do pip install . in the resulting directory. Then try installing the snappy wheel again.

enriqueartal commented 1 year ago

It did not work straightforward because I did not send the whole log; doing the same thing with low-index (cloning and installing). BTW, I do not know how to start snappy from the command line! But I can work inside inside sagemath which was the goal. Thanks!

NathanDunfield commented 1 year ago

You can start the app with python3 -m snappy.app assuming the Fedora package python3-tkinter is installed.

dimpase commented 1 year ago

Why does spherogram include Cython-generated files? Isn't Cython standard enough so that you don't have to do this?

dimpase commented 1 year ago

Should spherogram be a separate package on in SageMath?

NathanDunfield commented 1 year ago

Why does spherogram include Cython-generated files?

Because this is the practice that has always been recommended by the Cython docs. I believe the issue is many machines lack Cython or at least a sufficiently up-to-date version. Withpyproject.toml, you can now specify separate build-time requirements (like Cython), but that's a new development and snappy hasn't switched over to it entirely.

I think the real issue here is that we have yet to do a formal release of SnapPy that supports Python 3.11. I hope to do so in the next few weeks.

dimpase commented 1 year ago

I don't understand - pip install Cython isn't such a big deal. (I think it's a bad, outdated, advice on Cython side, too - probably from pre-pip times?)

dimpase commented 1 year ago

Please see https://github.com/cython/cython/issues/5089 - while Cython devs still sit on the fence regarding the issue, please feel free to voice your opinion there.