GPy: `pip install` fails with Python 3.7

Description

Unable to pip install with Python 3.7: error: no member named 'exc_type' in 'struct _ts'

Installing from devel-branch at HEAD also fails.

It seems like this is an Cython related issue (cython/cython#1978). There have been similar issues with pyyaml (yaml/pyyaml#126), numpy (numpy/numpy#10500), pygame (pygame/pygame#382) and scikit-learn (scikit-learn/scikit-learn#11320)

Steps/Code to Reproduce

Install Python 3.7 pip install gpy

Expected Results

pip succeeds.

Actual Results

  GPy/kern/src/stationary_cython.c:19389:21: error: no member named 'exc_type' in 'struct _ts'
      *type = tstate->exc_type;
              ~~~~~~  ^
  GPy/kern/src/stationary_cython.c:19390:22: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
      *value = tstate->exc_value;
                       ^~~~~~~~~
                       curexc_value
  /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
      PyObject *curexc_value;
                ^
  GPy/kern/src/stationary_cython.c:19391:19: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
      *tb = tstate->exc_traceback;
                    ^~~~~~~~~~~~~
                    curexc_traceback
  /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
      PyObject *curexc_traceback;
                ^
  GPy/kern/src/stationary_cython.c:19403:24: error: no member named 'exc_type' in 'struct _ts'
      tmp_type = tstate->exc_type;
                 ~~~~~~  ^
  GPy/kern/src/stationary_cython.c:19404:25: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
      tmp_value = tstate->exc_value;
                          ^~~~~~~~~
                          curexc_value
  /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
      PyObject *curexc_value;
                ^
  GPy/kern/src/stationary_cython.c:19405:22: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
      tmp_tb = tstate->exc_traceback;
                       ^~~~~~~~~~~~~
                       curexc_traceback
  /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
      PyObject *curexc_traceback;
                ^
  GPy/kern/src/stationary_cython.c:19406:13: error: no member named 'exc_type' in 'struct _ts'
      tstate->exc_type = type;
      ~~~~~~  ^
  GPy/kern/src/stationary_cython.c:19407:13: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
      tstate->exc_value = value;
              ^~~~~~~~~
              curexc_value
  /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
      PyObject *curexc_value;
                ^
  GPy/kern/src/stationary_cython.c:19408:13: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
      tstate->exc_traceback = tb;
              ^~~~~~~~~~~~~
              curexc_traceback
  /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
      PyObject *curexc_traceback;
                ^
  GPy/kern/src/stationary_cython.c:19451:24: error: no member named 'exc_type' in 'struct _ts'
      tmp_type = tstate->exc_type;
                 ~~~~~~  ^
  GPy/kern/src/stationary_cython.c:19452:25: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
      tmp_value = tstate->exc_value;
                          ^~~~~~~~~
                          curexc_value
  /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
      PyObject *curexc_value;
                ^
  GPy/kern/src/stationary_cython.c:19453:22: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
      tmp_tb = tstate->exc_traceback;
                       ^~~~~~~~~~~~~
                       curexc_traceback
  /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
      PyObject *curexc_traceback;
                ^
  GPy/kern/src/stationary_cython.c:19454:13: error: no member named 'exc_type' in 'struct _ts'
      tstate->exc_type = local_type;
      ~~~~~~  ^
  GPy/kern/src/stationary_cython.c:19455:13: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
      tstate->exc_value = local_value;
              ^~~~~~~~~
              curexc_value
  /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
      PyObject *curexc_value;
                ^
  GPy/kern/src/stationary_cython.c:19456:13: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
      tstate->exc_traceback = local_tb;
              ^~~~~~~~~~~~~
              curexc_traceback
  /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
      PyObject *curexc_traceback;
                ^
  GPy/kern/src/stationary_cython.c:19478:24: error: no member named 'exc_type' in 'struct _ts'
      tmp_type = tstate->exc_type;
                 ~~~~~~  ^
  GPy/kern/src/stationary_cython.c:19479:25: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
      tmp_value = tstate->exc_value;
                          ^~~~~~~~~
                          curexc_value
  /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
      PyObject *curexc_value;
                ^
  GPy/kern/src/stationary_cython.c:19480:22: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
      tmp_tb = tstate->exc_traceback;
                       ^~~~~~~~~~~~~
                       curexc_traceback
  /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
      PyObject *curexc_traceback;
                ^
  GPy/kern/src/stationary_cython.c:19481:13: error: no member named 'exc_type' in 'struct _ts'
      tstate->exc_type = *type;
      ~~~~~~  ^
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  10 warnings and 20 errors generated.
  error: command 'clang' failed with exit status 1

  ----------------------------------------
  Failed building wheel for GPy

Installed versions

python: 3.7.0.final.0 python-bits: 64 OS: Darwin OS-release: 17.6.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: en_US.UTF-8 LANG: en_US.UTF-8 LOCALE: en_US.UTF-8

pip: 10.0.1 setuptools: 39.2.0 Cython: 0.28.3 numpy: 1.14.5 scipy: 1.1.0

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 15
  • Comments: 25 (4 by maintainers)

Most upvoted comments

This is an issue with the package maintainers who include the precompiled *.c files instead of running cython over *.pyx. Here is a workaround:

git clone https://github.com/SheffieldML/GPy
find Gpy -name '*.pyx' -exec cython {} \;
pip install Gpy/

Just a reminder to everyone that this issue still exists…

This is an issue with the package maintainers who include the precompiled *.c files instead of running cython over *.pyx. Here is a workaround:

git clone https://github.com/SheffieldML/GPy
find Gpy -name '*.pyx' -exec cython {} \;
pip install Gpy/

Installing cython, scipy, matplotlib and using GPy instead of Gpy in @vmarkovtsev answer above worked for me.

conda install cython scipy matplotlib
git clone https://github.com/SheffieldML/GPy
find GPy -name '*.pyx' -exec cython {} \;
pip install GPy/

I also hava this problem when installing wordcloud on mac.

Yes, for now this is what I’m doing

import sys

if sys.version_info[1] >= 7:
    # Fix issue in paramz
    import re

    re._pattern_type = re.Pattern

I have this in __init__.py.

Greetings, I am having this problem as well, compiling on my MacOS Mojave using homebrew. Any resolution of this issue would be much appreciated. Many thanks!

There was already a PR (#677) to fix this. #691 and #690 are dups.

EDIT: Just saw that @cgohlke closed the PR without the commits being merged. Why?

@vmarkovtsev’s solution works. Do we have any idea when this can get fixed upstream in pip?