Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install fails with Python 3.11.4, Cython 3.0.1 #175

Closed
gwhitney opened this issue Aug 27, 2023 · 3 comments
Closed

Install fails with Python 3.11.4, Cython 3.0.1 #175

gwhitney opened this issue Aug 27, 2023 · 3 comments

Comments

@gwhitney
Copy link

There appears already to be awareness of problems with this install environment for cysignals (see e.g. #174 and https://groups.google.com/g/sage-devel/c/algn6mfImRk/m/fX4QT2MSCwAJ) but there did not seem to be an issue here recording the situation (and where someone searching for the issue might find any suggestions/workarounds for dealing with it until there is a permanent fix). If this should have been filed elsewhere, please advise, thanks.

Below is a transcript of a session on an OpenSUSE Linux machine, in a newly-created venv:

jnkpy> python --version
Python 3.11.4
jnkpy> pip install --upgrade pip
Requirement already satisfied: pip in ./myvenv/lib64/python3.11/site-packages (23.1.2)
Collecting pip
  Using cached pip-23.2.1-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 23.1.2
    Uninstalling pip-23.1.2:
      Successfully uninstalled pip-23.1.2
Successfully installed pip-23.2.1
jnkpy> pip install Cython
Collecting Cython
  Obtaining dependency information for Cython from https://files.pythonhosted.org/packages/d0/80/dbd9928e3a5411206197f6191cad60856c30a19a2a7c7e107233a34d3e3d/Cython-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
  Using cached Cython-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.1 kB)
Using cached Cython-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.6 MB)
Installing collected packages: Cython
Successfully installed Cython-3.0.1
jnkpy> pip install cysignals
Collecting cysignals
  Using cached cysignals-1.11.2.tar.gz (99 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: Cython>=0.28 in ./myvenv/lib64/python3.11/site-packages (from cysignals) (3.0.1)
Building wheels for collected packages: cysignals
  Building wheel for cysignals (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for cysignals (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [342 lines of output]
      running bdist_wheel
      running build
      running build_py
      running configure
      autoconf
      autoheader
      configure: loading site script /usr/share/site/x86_64-pc-linux-gnu
      checking for gcc... gcc
      checking whether the C compiler works... yes
      checking for C compiler default output file name... a.out
      checking for suffix of executables...
      checking whether we are cross compiling... no
      checking for suffix of object files... o
      checking whether the compiler supports GNU C... yes
      checking whether gcc accepts -g... yes
      checking for gcc option to enable C11 features... none needed
      checking whether the compiler supports GNU C++... yes
      checking whether gcc accepts -g... yes
      checking for gcc option to enable C++11 features... none needed
      checking for stdio.h... yes
      checking for stdlib.h... yes
      checking for string.h... yes
      checking for inttypes.h... yes
      checking for stdint.h... yes
      checking for strings.h... yes
      checking for sys/stat.h... yes
      checking for sys/types.h... yes
      checking for unistd.h... yes
      checking for execinfo.h... yes
      checking for sys/mman.h... yes
      checking for sys/prctl.h... yes
      checking for sys/time.h... yes
      checking for sys/wait.h... yes
      checking for windows.h... no
      checking for fork... yes
      checking for kill... yes
      checking for sigprocmask... yes
      checking for sigaltstack... yes
      checking for backtrace... yes
      checking for gcc options needed to detect all undeclared functions... none needed
      checking for library containing pari_init... -lpari
      checking whether PARI_SIGINT_block is declared... yes
      checking for emms instruction... yes
      checking whether setjmp() saves the signal mask... no
      checking for GNU libc... yes
      checking for _Atomic in C code... yes
      checking for _Atomic with OpenMP in C code... yes
      checking for _Atomic in C++ code... no
      checking for std::atomic... yes
      checking for std::atomic with OpenMP in C++ code... yes
      checking whether MINSIGSTKSZ is constant... no
      configure: creating ./config.status
      config.status: creating src/cysignals/signals.pxd
      config.status: creating src/config.h
      config.status: creating src/cysignals/cysignals_config.h
      creating build
      creating build/lib.linux-x86_64-cpython-311
      creating build/lib.linux-x86_64-cpython-311/cysignals
      copying src/cysignals/__init__.py -> build/lib.linux-x86_64-cpython-311/cysignals
      copying src/cysignals/signals.pxd -> build/lib.linux-x86_64-cpython-311/cysignals
      copying src/cysignals/pysignals.pxd -> build/lib.linux-x86_64-cpython-311/cysignals
      copying src/cysignals/memory.pxd -> build/lib.linux-x86_64-cpython-311/cysignals
      copying src/cysignals/cysignals_config.h -> build/lib.linux-x86_64-cpython-311/cysignals
      copying src/cysignals/struct_signals.h -> build/lib.linux-x86_64-cpython-311/cysignals
      copying src/cysignals/macros.h -> build/lib.linux-x86_64-cpython-311/cysignals
      running build_ext
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      
      # This function does nothing, but it is declared cdef except *, so it
      # can be used to make Cython check whether there is a pending exception
      # (PyErr_Occurred() is non-NULL). To Cython, it will look like
      # cython_check_exception() actually raised the exception.
      cdef inline void cython_check_exception() nogil except *:
                                                              ^
      ------------------------------------------------------------
      
      src/cysignals/signals.pxd:57:56: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
      
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      import sys
      from gc import collect
      
      
      cdef extern from "implementation.c":
          cysigs_t cysigs
          ^
      ------------------------------------------------------------
      
      src/cysignals/signals.pyx:39:4: 'cysigs_t' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              PyErr_SetString(SignalError, msg)
          else:
              PyErr_Format(SystemError, "unknown signal number %i", sig)
      
          # Save exception in cysigs.exc_value
          cdef PyObject* typ
               ^
      ------------------------------------------------------------
      
      src/cysignals/signals.pyx:162:9: 'PyObject' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          else:
              PyErr_Format(SystemError, "unknown signal number %i", sig)
      
          # Save exception in cysigs.exc_value
          cdef PyObject* typ
          cdef PyObject* val
               ^
      ------------------------------------------------------------
      
      src/cysignals/signals.pyx:163:9: 'PyObject' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              PyErr_Format(SystemError, "unknown signal number %i", sig)
      
          # Save exception in cysigs.exc_value
          cdef PyObject* typ
          cdef PyObject* val
          cdef PyObject* tb
               ^
      ------------------------------------------------------------
      
      src/cysignals/signals.pyx:164:9: 'PyObject' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          cdef PyObject* val
          cdef PyObject* tb
          PyErr_Fetch(&typ, &val, &tb)
          PyErr_NormalizeException(&typ, &val, &tb)
          Py_XINCREF(val)
          Py_XDECREF(cysigs.exc_value)
                           ^
      ------------------------------------------------------------
      
      src/cysignals/signals.pyx:168:21: Cannot convert Python object to 'PyObject *'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          """
          Python-level interrupt handler for interrupts raised in Python
          code. This simply delegates to the interrupt handling code in
          ``implementation.c``.
          """
          sig_check()
          ^
      ------------------------------------------------------------
      
      src/cysignals/signals.pyx:310:4: undeclared name not builtin: sig_check
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          Check that ``cysigs.exc_value`` is still the exception being raised.
          Clear ``cysigs.exc_value`` if not.
          """
          if cysigs.exc_value.ob_refcnt == 1:
              # No other references => exception is certainly gone
              Py_XDECREF(cysigs.exc_value)
                               ^
      ------------------------------------------------------------
      
      src/cysignals/signals.pyx:320:25: Cannot convert Python object to 'PyObject *'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          Clear ``cysigs.exc_value`` if not.
          """
          if cysigs.exc_value.ob_refcnt == 1:
              # No other references => exception is certainly gone
              Py_XDECREF(cysigs.exc_value)
              cysigs.exc_value = NULL
                                 ^
      ------------------------------------------------------------
      
      src/cysignals/signals.pyx:321:27: Cannot convert 'void *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          try:
              handled = sys.last_value
          except AttributeError:
              pass
          else:
              if <PyObject*>handled is cysigs.exc_value:
                  ^
      ------------------------------------------------------------
      
      src/cysignals/signals.pyx:351:12: 'PyObject' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              handled = sys.last_value
          except AttributeError:
              pass
          else:
              if <PyObject*>handled is cysigs.exc_value:
                  Py_XDECREF(cysigs.exc_value)
                                   ^
      ------------------------------------------------------------
      
      src/cysignals/signals.pyx:352:29: Cannot convert Python object to 'PyObject *'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          except AttributeError:
              pass
          else:
              if <PyObject*>handled is cysigs.exc_value:
                  Py_XDECREF(cysigs.exc_value)
                  cysigs.exc_value = NULL
                                     ^
      ------------------------------------------------------------
      
      src/cysignals/signals.pyx:353:31: Cannot convert 'void *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              pass
      
          # Make sure we still have cysigs.exc_value at all; if this function was
          # called again during garbage collection it might have already been set
          # to NULL; see https://github.com/sagemath/cysignals/issues/126
          if cysigs.exc_value != NULL and cysigs.exc_value.ob_refcnt == 1:
                              ^
      ------------------------------------------------------------
      
      src/cysignals/signals.pyx:368:24: Invalid types for '!=' (Python object, void *)
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      
          # Make sure we still have cysigs.exc_value at all; if this function was
          # called again during garbage collection it might have already been set
          # to NULL; see https://github.com/sagemath/cysignals/issues/126
          if cysigs.exc_value != NULL and cysigs.exc_value.ob_refcnt == 1:
              Py_XDECREF(cysigs.exc_value)
                               ^
      ------------------------------------------------------------
      
      src/cysignals/signals.pyx:369:25: Cannot convert Python object to 'PyObject *'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          # Make sure we still have cysigs.exc_value at all; if this function was
          # called again during garbage collection it might have already been set
          # to NULL; see https://github.com/sagemath/cysignals/issues/126
          if cysigs.exc_value != NULL and cysigs.exc_value.ob_refcnt == 1:
              Py_XDECREF(cysigs.exc_value)
              cysigs.exc_value = NULL
                                 ^
      ------------------------------------------------------------
      
      src/cysignals/signals.pyx:370:27: Cannot convert 'void *' to Python object
      Compiling src/cysignals/signals.pyx because it changed.
      Compiling src/cysignals/pysignals.pyx because it changed.
      Compiling src/cysignals/alarm.pyx because it changed.
      Compiling src/cysignals/pselect.pyx because it changed.
      Compiling src/cysignals/tests.pyx because it changed.
      [1/5] Cythonizing src/cysignals/alarm.pyx
      [2/5] Cythonizing src/cysignals/pselect.pyx
      [3/5] Cythonizing src/cysignals/pysignals.pyx
      [4/5] Cythonizing src/cysignals/signals.pyx
      Traceback (most recent call last):
        File "/home/glen/jnk/jnkpy/myvenv/lib64/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/glen/jnk/jnkpy/myvenv/lib64/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/glen/jnk/jnkpy/myvenv/lib64/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 434, in build_wheel
          return self._build_with_temp_dir(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 419, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 507, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 193, in <module>
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 107, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1233, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 364, in run
          self.run_command("build")
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1233, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1233, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-ljhjrdc1/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "<string>", line 152, in run
        File "<string>", line 163, in cythonize
        File "/tmp/pip-build-env-ljhjrdc1/normal/lib64/python3.11/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
          cythonize_one(*args)
        File "/tmp/pip-build-env-ljhjrdc1/normal/lib64/python3.11/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: src/cysignals/signals.pyx
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cysignals
Failed to build cysignals
ERROR: Could not build wheels for cysignals, which is required to install pyproject.toml-based projects
@gwhitney
Copy link
Author

Just wanted to confirm that I can successfully install cysignals if I execute pip install Cython==0.29.36 prior to attempting the cysignals installation.

@fffmath
Copy link

fffmath commented Sep 29, 2023

Just wanted to confirm that I can successfully install cysignals if I execute pip install Cython==0.29.36 prior to attempting the cysignals installation.

It works for me.

@dimpase
Copy link
Member

dimpase commented Oct 4, 2023

cython 3 is now fixed in main, and will be in the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants