On 11/27/22 19:24, Nilesh Patra wrote: > On Sun, Nov 27, 2022 at 05:35:17PM +0000, Tobias Hansen wrote: >> On 11/27/22 06:37, Nilesh Patra wrote: >>> Tobias, since this is done, would you consider to check sagemath now and >>> get the ball rolling? :-) >> Hi, >> >> I actually tried building with the new pari and gap versions a while ago >> (using sagemath 9.5 with upstream patches for the new pari and gap versions, >> I pushed them to the git repo today) and got stuck with a lot of errors like >> this (might be unrelated to pari and gap): > I am having a hard time building/reproducing this because sage tends to need > a lot of compute power that I currently do not have, and it takes forever to > porter box too. > But looking at the error, my hunch is that this is a setuptools related > monkeypatch issue (there are similar RC bugs filed for many packages). So > re-ordering cython import > in sage/misc/cython.py file after setuptools along with ensuring distutils is > imported after setuptools will (very) likely help. > > Here is a related link that I found for the same > > > https://stackoverflow.com/questions/21594925/error-each-element-of-ext-modules-option-must-be-an-extension-instance-or-2-t > Thanks. The attached patch removed the error, but now there are these warnings when cython is used in doctests:
UserWarning: Distutils was imported before Setuptools, but importing Setuptools also replaces the `distutils` module in `sys.modules`. This may lead to undesirable behaviors or errors. To avoid these issues, avoid using distutils directly, ensure that setuptools is installed in the traditional way (e.g. not an editable install), and/or make sure that setuptools is always imported before distutils. UserWarning: Setuptools is replacing distutils. and DeprecationWarning: msvccompiler is deprecated and slated to be removed in the future. Please discontinue use or file an issue with pypa/distutils describing your use case. Best, Tobias
Description: Import setuptools before cython To fix the error distutils.errors.DistutilsSetupError: each element of 'ext_modules' option must be an Extension instance or 2-tuple Author: Tobias Hansen <than...@debian.org> --- a/sage/src/sage/misc/cython.py +++ b/sage/src/sage/misc/cython.py @@ -285,9 +285,6 @@ includes = [os.getcwd()] + standard_includes # Now do the actual build, directly calling Cython and distutils - from Cython.Build import cythonize - from Cython.Compiler.Errors import CompileError - import Cython.Compiler.Options try: # Import setuptools before importing distutils, so that setuptools @@ -301,6 +298,10 @@ from distutils.dist import Distribution from distutils.core import Extension + from Cython.Build import cythonize + from Cython.Compiler.Errors import CompileError + import Cython.Compiler.Options + from distutils.log import set_verbosity set_verbosity(verbose)