cschwan / sage-on-gentoo

(Unofficial) Gentoo Overlay for Sage- and Sage-related ebuilds
84 stars 26 forks source link

sci-mathematics/sage: 'gmpy2.pxd' not found #512

Closed WGH- closed 6 years ago

WGH- commented 6 years ago

I'm not sure why it happened. I'm updating sage from 8.1-r2 to -8.2-r2. I have dev-python/gmpy-2.0.8:2::gentoo installed. I'm on 31a8345172dc (current master).

-> First build of interpreters
running build_cython
Enabling Cython debugging support
Updating Cython code....
sage/rings/complex_double.pyx: cannot find cimported module 'gmpy2'
sage/rings/complex_number.pyx: cannot find cimported module 'gmpy2'
sage/rings/integer.pyx: cannot find cimported module 'gmpy2'
sage/rings/complex_mpc.pyx: cannot find cimported module 'gmpy2'
sage/rings/rational.pyx: cannot find cimported module 'gmpy2'
sage/rings/real_double.pyx: cannot find cimported module 'gmpy2'
sage/rings/real_mpfr.pyx: cannot find cimported module 'gmpy2'

(the build continues, though)

[337/489] Cythonizing sage/plot/complex_plot.pyx
[340/489] Cythonizing sage/plot/plot3d
Error compiling Cython file:
------------------------------------------------------------
...
from .real_mpfr import mpfr_prec_min, mpfr_prec_max
from sage.structure.richcmp cimport rich_to_bool, richcmp
from sage.categories.fields import Fields

IF HAVE_GMPY2:
    cimport gmpy2
           ^
------------------------------------------------------------

sage/rings/complex_mpc.pyx:90:12: 'gmpy2.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
from sage.structure.richcmp cimport rich_to_bool, richcmp
from sage.categories.fields import Fields

IF HAVE_GMPY2:
    cimport gmpy2
    gmpy2.import_gmpy2()
        ^
------------------------------------------------------------

sage/rings/complex_mpc.pyx:91:9: cimported module has no attribute 'import_gmpy2'

Error compiling Cython file:
------------------------------------------------------------
...
                real, imag = z.real, z.imag
            elif isinstance(z, sage.symbolic.expression.Expression):
                zz = sage.rings.complex_field.ComplexField(self._parent.prec())(z)
                self._set(zz)
                return
            elif HAVE_GMPY2 and type(z) is gmpy2.mpc:
                                               ^
------------------------------------------------------------

sage/rings/complex_mpc.pyx:876:48: cimported module has no attribute 'mpc'

Error compiling Cython file:
------------------------------------------------------------
...
            elif isinstance(z, sage.symbolic.expression.Expression):
                zz = sage.rings.complex_field.ComplexField(self._parent.prec())(z)
                self._set(zz)
                return
            elif HAVE_GMPY2 and type(z) is gmpy2.mpc:
                mpc_set(self.value, (<gmpy2.mpc>z).c, rnd)
                                     ^
------------------------------------------------------------

sage/rings/complex_mpc.pyx:877:38: 'mpc' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            elif isinstance(z, sage.symbolic.expression.Expression):
                zz = sage.rings.complex_field.ComplexField(self._parent.prec())(z)
                self._set(zz)
                return
            elif HAVE_GMPY2 and type(z) is gmpy2.mpc:
                mpc_set(self.value, (<gmpy2.mpc>z).c, rnd)
                                                 ^
------------------------------------------------------------

sage/rings/complex_mpc.pyx:877:50: Cannot convert Python object to 'mpc_srcptr'

Error compiling Cython file:
------------------------------------------------------------
...
                return
            elif HAVE_GMPY2 and type(z) is gmpy2.mpc:
                mpc_set(self.value, (<gmpy2.mpc>z).c, rnd)
                return
            # then, no imaginary part
            elif HAVE_GMPY2 and type(z) is gmpy2.mpfr:
                                               ^
------------------------------------------------------------

sage/rings/complex_mpc.pyx:880:48: cimported module has no attribute 'mpfr'

Error compiling Cython file:
------------------------------------------------------------
...
            elif HAVE_GMPY2 and type(z) is gmpy2.mpc:
                mpc_set(self.value, (<gmpy2.mpc>z).c, rnd)
                return
            # then, no imaginary part
            elif HAVE_GMPY2 and type(z) is gmpy2.mpfr:
                mpc_set_fr(self.value, (<gmpy2.mpfr>z).f, rnd)
                                        ^
------------------------------------------------------------

sage/rings/complex_mpc.pyx:881:41: 'mpfr' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            elif HAVE_GMPY2 and type(z) is gmpy2.mpc:
                mpc_set(self.value, (<gmpy2.mpc>z).c, rnd)
                return
            # then, no imaginary part
            elif HAVE_GMPY2 and type(z) is gmpy2.mpfr:
                mpc_set_fr(self.value, (<gmpy2.mpfr>z).f, rnd)
                                                     ^
------------------------------------------------------------

sage/rings/complex_mpc.pyx:881:54: Cannot convert Python object to 'mpfr_srcptr'

Error compiling Cython file:
------------------------------------------------------------
...
                return
            # then, no imaginary part
            elif HAVE_GMPY2 and type(z) is gmpy2.mpfr:
                mpc_set_fr(self.value, (<gmpy2.mpfr>z).f, rnd)
                return
            elif HAVE_GMPY2 and type(z) is gmpy2.mpq:
                                               ^
------------------------------------------------------------

sage/rings/complex_mpc.pyx:883:48: cimported module has no attribute 'mpq'

Error compiling Cython file:
------------------------------------------------------------
...
            # then, no imaginary part
            elif HAVE_GMPY2 and type(z) is gmpy2.mpfr:
                mpc_set_fr(self.value, (<gmpy2.mpfr>z).f, rnd)
                return
            elif HAVE_GMPY2 and type(z) is gmpy2.mpq:
                mpc_set_q(self.value, (<gmpy2.mpq>z).q, rnd)
                                       ^
------------------------------------------------------------

sage/rings/complex_mpc.pyx:884:40: 'mpq' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            # then, no imaginary part
            elif HAVE_GMPY2 and type(z) is gmpy2.mpfr:
                mpc_set_fr(self.value, (<gmpy2.mpfr>z).f, rnd)
                return
            elif HAVE_GMPY2 and type(z) is gmpy2.mpq:
                mpc_set_q(self.value, (<gmpy2.mpq>z).q, rnd)
                                                   ^
------------------------------------------------------------

sage/rings/complex_mpc.pyx:884:52: Cannot convert Python object to 'mpq_srcptr'

Error compiling Cython file:
------------------------------------------------------------
...
                mpc_set_fr(self.value, (<gmpy2.mpfr>z).f, rnd)
                return
            elif HAVE_GMPY2 and type(z) is gmpy2.mpq:
                mpc_set_q(self.value, (<gmpy2.mpq>z).q, rnd)
                return
            elif HAVE_GMPY2 and type(z) is gmpy2.mpz:
                                               ^
------------------------------------------------------------

sage/rings/complex_mpc.pyx:886:48: cimported module has no attribute 'mpz'

Error compiling Cython file:
------------------------------------------------------------
...
                return
            elif HAVE_GMPY2 and type(z) is gmpy2.mpq:
                mpc_set_q(self.value, (<gmpy2.mpq>z).q, rnd)
                return
            elif HAVE_GMPY2 and type(z) is gmpy2.mpz:
                mpc_set_z(self.value, (<gmpy2.mpz>z).z, rnd)
                                       ^
------------------------------------------------------------

sage/rings/complex_mpc.pyx:887:40: 'mpz' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
                return
            elif HAVE_GMPY2 and type(z) is gmpy2.mpq:
                mpc_set_q(self.value, (<gmpy2.mpq>z).q, rnd)
                return
            elif HAVE_GMPY2 and type(z) is gmpy2.mpz:
                mpc_set_z(self.value, (<gmpy2.mpz>z).z, rnd)
                                                   ^
------------------------------------------------------------

sage/rings/complex_mpc.pyx:887:52: Cannot convert Python object to 'mpz_srcptr'

Error compiling Cython file:
------------------------------------------------------------
...
            Traceback (most recent call last):
            ...
            NotImplementedError: gmpy2 is not installed
        """
        IF HAVE_GMPY2:
            return gmpy2.GMPy_MPC_From_mpfr(self.value.re, self.value.im)
                       ^
------------------------------------------------------------

sage/rings/complex_mpc.pyx:1301:24: cimported module has no attribute 'GMPy_MPC_From_mpfr'
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/Cython/Build/Dependencies.py", line 1164, in cythonize_one_helper
    return cythonize_one(*m)
  File "/usr/lib64/python2.7/site-packages/Cython/Build/Dependencies.py", line 1146, in cythonize_one
    raise CompileError(None, pyx_file)
CompileError: sage/rings/complex_mpc.pyx
************************************************************************
Traceback (most recent call last):
  File "setup.py", line 947, in <module>
    ext_modules = ext_modules)
  File "/usr/lib64/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "setup.py", line 856, in run
    build.run(self)
  File "/usr/lib64/python2.7/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
  File "/usr/lib64/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "setup.py", line 375, in run
    cache=False,
  File "/usr/lib64/python2.7/site-packages/Cython/Build/Dependencies.py", line 1017, in cythonize
    result.get(99999)  # seconds
  File "/usr/lib64/python2.7/multiprocessing/pool.py", line 572, in get
    raise self._value
CompileError: sage/rings/complex_mpc.pyx
************************************************************************
Error building the Sage library
************************************************************************
 * ERROR: sci-mathematics/sage-8.2-r2::sage-on-gentoo failed (compile phase):
 *   (no error message)
WGH- commented 6 years ago

Is gmpy2.pxd supposed to be installed by dev-python/gmpy? Because dev-python/gmpy-2.0.8 doesn't install such file.

Apparently, gmpy started to install this file in commit https://github.com/aleaxit/gmpy/commit/bf915504dd74d8b5a87a3a30733531bb1b091af5, which is 2.1.0a1. Quick testing in virtualenv confirmed it. Git master branch version installs gmpy2.pxd, whereas 2.0.8 from PyPI doesn't.

kiwifb commented 6 years ago

Upstream started to work on adding some support for gmpy-2.1.0+ and it is done in an automagic way that can cause breakages. I meant to work out if the version of the main tree caused breakage but I never got around testing. I will fix this ASAP.

kiwifb commented 6 years ago

OK this should now be fixed in a forward thinking manner. When gmpy2.1.0 becomes available and is stable, I can add it as an option with my existing option mechanism. Please tell me if it fixed things for you.

WGH- commented 6 years ago

Thank you, it fixed the build issue for me.