scipy 1.4+ install: error: ‘PyModule_AddFunctions’ was not declared in this scope

Create issue
Issue #3131 new
Jan Vesely created an issue

updating scipy to 1.4 results in:

  /var/tmp/pip-build-env-q588n5yp/overlay/site-packages/numpy/distutils/system_info.py:664: UserWarning: Specified path /var/tmp/pip-build-env-q588n5yp/overlay/site-packages/numpy/__init__.py/include is invalid.
    return self.get_paths(self.section, key)
  /var/tmp/pip-build-env-q588n5yp/overlay/site-packages/numpy/distutils/system_info.py:664: UserWarning: Specified path /usr/local/include/include is invalid.
    return self.get_paths(self.section, key)
  /var/tmp/pip-build-env-q588n5yp/overlay/site-packages/numpy/distutils/system_info.py:664: UserWarning: Specified path /usr/include/include is invalid.
    return self.get_paths(self.section, key)
  /var/tmp/pip-build-env-q588n5yp/overlay/site-packages/numpy/distutils/system_info.py:664: UserWarning: Specified path /home/user/pypy3-venv/include/include is invalid.
    return self.get_paths(self.section, key)
  error: Command "g++ -pthread -fPIC -DPOCKETFFT_PTHREADS -I/home/user/pypy3-venv/include/site/python3.6 -I/home/user/pypy3-venv/include/site/python3.6 -I/var/tmp/pip-build-env-q588n5yp/overlay/site-packages/numpy/core/include -I/home/user/pypy3-venv/include -I/usr/lib/pypy3.6/include -c scipy/fft/_pocketfft/pypocketfft.cxx -o build/temp.linux-x86_64-3.6/scipy/fft/_pocketfft/pypocketfft.o -MMD -MF build/temp.linux-x86_64-3.6/scipy/fft/_pocketfft/pypocketfft.o.d -std=c++14 -fvisibility=hidden" failed with exit status 1
  scipy/fft/_pocketfft/pypocketfft.cxx: In function ‘void pybind11_init_pypocketfft(pybind11::module&)’:
  scipy/fft/_pocketfft/pypocketfft.cxx:731:3: error: ‘PyModule_AddFunctions’ was not declared in this scope
    731 |   PyModule_AddFunctions(m.ptr(), good_size_meth);
        |   ^~~~~~~~~~~~~~~~~~~~~
  scipy/fft/_pocketfft/pypocketfft.cxx: In function ‘void pybind11_init_pypocketfft(pybind11::module&)’:
  scipy/fft/_pocketfft/pypocketfft.cxx:731:3: error: ‘PyModule_AddFunctions’ was not declared in this scope
    731 |   PyModule_AddFunctions(m.ptr(), good_size_meth);

the attached log is for:

$ pypy3 --version
Python 3.6.9 (5da45ced70e515f94686be0df47c59abd1348ebc, Nov 02 2019, 18:56:40)
[PyPy 7.2.0 with GCC 8.3.0]

but the same problem appears in:

$ python --version
Python 3.7.4 (47c4c0ed3274, Dec 20 2019, 17:37:49)
[PyPy 7.3.0-alpha0 with GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]

and:

$ python --version
Python 3.6.9 (574325fb0c26, Dec 20 2019, 17:38:07)
[PyPy 7.3.1-alpha0 with GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]

scipy 1.3.x works OK.

Comments (4)

  1. mattip

    Thanks for the report. That was added to scipy in 2019-09-12 for the fft support of pybind11, and it seems we do not yet support it.

  2. Jan Vesely reporter

    Thank you for swift response. The error has now changed to:

      In file included from /home/user/pypy/include/Python.h:79,
                       from scipy/_lib/_uarray/_uarray_dispatch.cxx:2:
      scipy/_lib/_uarray/_uarray_dispatch.cxx: In member function {anonymous}::py_func_args {anonymous}::Function::replace_dispatchables(PyObject*, PyObject*, PyObject*, PyObject*):
      /home/user/pypy/include/tupleobject.h:35:28: error: base operand of -> has non-pointer type {anonymous}::py_ref
         35 |    PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_TUPLE_SUBCLASS)
            |                            ^~
      /home/user/pypy/include/object.h:243:36: note: in definition of macro PyType_HasFeature
        243 | #define PyType_HasFeature(t,f)  (((t)->tp_flags & (f)) != 0)
            |                                    ^
      /home/user/pypy/include/tupleobject.h:35:4: note: in expansion of macro PyType_FastSubclass
         35 |    PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_TUPLE_SUBCLASS)
            |    ^~~~~~~~~~~~~~~~~~~
      scipy/_lib/_uarray/_uarray_dispatch.cxx:722:8: note: in expansion of macro PyTuple_Check
        722 |   if (!PyTuple_Check(res) || PyTuple_Size(res) != 2)
            |        ^~~~~~~~~~~~~
      /home/user/pypy/include/tupleobject.h:35:28: error: base operand of -> has non-pointer type {anonymous}::py_ref
         35 |    PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_TUPLE_SUBCLASS)
            |                            ^~
      /home/user/pypy/include/object.h:243:36: note: in definition of macro PyType_HasFeature
        243 | #define PyType_HasFeature(t,f)  (((t)->tp_flags & (f)) != 0)
            |                                    ^
      /home/user/pypy/include/tupleobject.h:35:4: note: in expansion of macro PyType_FastSubclass
         35 |    PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_TUPLE_SUBCLASS)
            |    ^~~~~~~~~~~~~~~~~~~
      scipy/_lib/_uarray/_uarray_dispatch.cxx:734:8: note: in expansion of macro PyTuple_Check
        734 |   if (!PyTuple_Check(new_args) || !PyDict_Check(new_kwargs))
            |        ^~~~~~~~~~~~~
      /home/user/pypy/include/dictobject.h:16:28: error: base operand of -> has non-pointer type {anonymous}::py_ref
         16 |    PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_DICT_SUBCLASS)
            |                            ^~
      /home/user/pypy/include/object.h:243:36: note: in definition of macro PyType_HasFeature
        243 | #define PyType_HasFeature(t,f)  (((t)->tp_flags & (f)) != 0)
            |                                    ^
      /home/user/pypy/include/dictobject.h:16:4: note: in expansion of macro PyType_FastSubclass
         16 |    PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_DICT_SUBCLASS)
            |    ^~~~~~~~~~~~~~~~~~~
      scipy/_lib/_uarray/_uarray_dispatch.cxx:734:36: note: in expansion of macro PyDict_Check
        734 |   if (!PyTuple_Check(new_args) || !PyDict_Check(new_kwargs))
            |                                    ^~~~~~~~~~~~
    ERROR: compile scipy/_lib/_uarray/_uarray_dispatch.cxx on localhost failed
    

    scipy-1.3.3 still installs and works ok.

  3. Jan Vesely reporter

    scipy-1.4.1 install ok on py36 branch.
    presumably 98441:433283f3338b fixed the above problem.
    py37 still fails:

     compile options: '-DPOCKETFFT_PTHREADS -I/home/user/pypy37-venv/include/site/python3.7 -I/home/user/pypy37-venv/include/site/python3.7 -I/tmp/pip-build-env-xw64l04m/overlay/site-packages/numpy/core/include -I/home/user/pypy37-venv/include -I/home/user/pypy37/include -c'
      extra options: '-std=c++14 -fvisibility=hidden'
      g++: scipy/fft/_pocketfft/pypocketfft.cxx
      In file included from /home/user/pypy37-venv/include/site/python3.7/pybind11/cast.h:16,
                       from /home/user/pypy37-venv/include/site/python3.7/pybind11/attr.h:13,
                       from /home/user/pypy37-venv/include/site/python3.7/pybind11/pybind11.h:44,
                       from scipy/fft/_pocketfft/pypocketfft.cxx:15:
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:24:40: error: Py_tss_t does not name a type; did you mean Py_hash_t?
         24 | #    define PYBIND11_TLS_KEY_INIT(var) Py_tss_t *var = nullptr
            |                                        ^~~~~~~~
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:109:5: note: in expansion of macro PYBIND11_TLS_KEY_INIT
        109 |     PYBIND11_TLS_KEY_INIT(tstate);
            |     ^~~~~~~~~~~~~~~~~~~~~
      In file included from /home/user/pypy37-venv/include/site/python3.7/pybind11/cast.h:16,
                       from /home/user/pypy37-venv/include/site/python3.7/pybind11/attr.h:13,
                       from /home/user/pypy37-venv/include/site/python3.7/pybind11/pybind11.h:44,
                       from scipy/fft/_pocketfft/pypocketfft.cxx:15:
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h: In function pybind11::detail::internals& pybind11::detail::get_internals():
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:266:28: error: struct pybind11::detail::internals has no member named tstate; did you mean istate?
        266 |             internals_ptr->tstate = PyThread_tss_alloc();
            |                            ^~~~~~
            |                            istate
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:266:37: error: PyThread_tss_alloc was not declared in this scope; did you mean PyThread_type_lock?
        266 |             internals_ptr->tstate = PyThread_tss_alloc();
            |                                     ^~~~~~~~~~~~~~~~~~
            |                                     PyThread_type_lock
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:267:33: error: struct pybind11::detail::internals has no member named tstate; did you mean istate?
        267 |             if (!internals_ptr->tstate || PyThread_tss_create(internals_ptr->tstate))
            |                                 ^~~~~~
            |                                 istate
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:267:78: error: struct pybind11::detail::internals has no member named tstate; did you mean istate?
        267 |             if (!internals_ptr->tstate || PyThread_tss_create(internals_ptr->tstate))
            |                                                                              ^~~~~~
            |                                                                              istate
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:267:43: error: PyThread_tss_create was not declared in this scope; did you mean pthread_key_create?
        267 |             if (!internals_ptr->tstate || PyThread_tss_create(internals_ptr->tstate))
            |                                           ^~~~~~~~~~~~~~~~~~~
            |                                           pthread_key_create
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:269:45: error: struct pybind11::detail::internals has no member named tstate; did you mean istate?
        269 |             PyThread_tss_set(internals_ptr->tstate, tstate);
            |                                             ^~~~~~
            |                                             istate
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:269:13: error: PyThread_tss_set was not declared in this scope; did you mean PyThreadState_Get?
        269 |             PyThread_tss_set(internals_ptr->tstate, tstate);
            |             ^~~~~~~~~~~~~~~~
            |             PyThreadState_Get
      distcc[2855603] ERROR: compile scipy/fft/_pocketfft/pypocketfft.cxx on localhost failed
      In file included from /home/user/pypy37-venv/include/site/python3.7/pybind11/cast.h:16,
                       from /home/user/pypy37-venv/include/site/python3.7/pybind11/attr.h:13,
                       from /home/user/pypy37-venv/include/site/python3.7/pybind11/pybind11.h:44,
                       from scipy/fft/_pocketfft/pypocketfft.cxx:15:
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:24:40: error: Py_tss_t does not name a type; did you mean Py_hash_t?
         24 | #    define PYBIND11_TLS_KEY_INIT(var) Py_tss_t *var = nullptr
            |                                        ^~~~~~~~
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:109:5: note: in expansion of macro PYBIND11_TLS_KEY_INIT
        109 |     PYBIND11_TLS_KEY_INIT(tstate);
            |     ^~~~~~~~~~~~~~~~~~~~~
      In file included from /home/user/pypy37-venv/include/site/python3.7/pybind11/cast.h:16,
                       from /home/user/pypy37-venv/include/site/python3.7/pybind11/attr.h:13,
                       from /home/user/pypy37-venv/include/site/python3.7/pybind11/pybind11.h:44,
                       from scipy/fft/_pocketfft/pypocketfft.cxx:15:
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h: In function pybind11::detail::internals& pybind11::detail::get_internals():
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:266:28: error: struct pybind11::detail::internals has no member named tstate; did you mean istate?
        266 |             internals_ptr->tstate = PyThread_tss_alloc();
            |                            ^~~~~~
            |                            istate
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:266:37: error: PyThread_tss_alloc was not declared in this scope; did you mean PyThread_type_lock?
        266 |             internals_ptr->tstate = PyThread_tss_alloc();
            |                                     ^~~~~~~~~~~~~~~~~~
            |                                     PyThread_type_lock
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:267:33: error: struct pybind11::detail::internals has no member named tstate; did you mean istate?
        267 |             if (!internals_ptr->tstate || PyThread_tss_create(internals_ptr->tstate))
            |                                 ^~~~~~
            |                                 istate
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:267:78: error: struct pybind11::detail::internals has no member named tstate; did you mean istate?
        267 |             if (!internals_ptr->tstate || PyThread_tss_create(internals_ptr->tstate))
            |                                                                              ^~~~~~
            |                                                                              istate
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:267:43: error: PyThread_tss_create was not declared in this scope; did you mean pthread_key_create?
        267 |             if (!internals_ptr->tstate || PyThread_tss_create(internals_ptr->tstate))
            |                                           ^~~~~~~~~~~~~~~~~~~
            |                                           pthread_key_create
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:269:45: error: struct pybind11::detail::internals has no member named tstate; did you mean istate?
        269 |             PyThread_tss_set(internals_ptr->tstate, tstate);
            |                                             ^~~~~~
            |                                             istate
      /home/user/pypy37-venv/include/site/python3.7/pybind11/detail/internals.h:269:13: error: PyThread_tss_set was not declared in this scope; did you mean PyThreadState_Get?
        269 |             PyThread_tss_set(internals_ptr->tstate, tstate);
            |             ^~~~~~~~~~~~~~~~
            |             PyThreadState_Get
      distcc[2855603] ERROR: compile scipy/fft/_pocketfft/pypocketfft.cxx on localhost failedRunning from scipy source directory.
      /tmp/pip-build-env-xw64l04m/overlay/site-packages/numpy/distutils/system_info.py:716: UserWarning: Specified path /tmp/pip-build-env-xw64l04m/overlay/site-packages/numpy/__init__.py/include is invalid.
        return self.get_paths(self.section, key)
      /tmp/pip-build-env-xw64l04m/overlay/site-packages/numpy/distutils/system_info.py:716: UserWarning: Specified path /usr/local/include/include is invalid.
        return self.get_paths(self.section, key)
      /tmp/pip-build-env-xw64l04m/overlay/site-packages/numpy/distutils/system_info.py:716: UserWarning: Specified path /usr/include/include is invalid.
        return self.get_paths(self.section, key)
      /tmp/pip-build-env-xw64l04m/overlay/site-packages/numpy/distutils/system_info.py:716: UserWarning: Specified path /home/user/pypy37-venv/include/include is invalid.
        return self.get_paths(self.section, key)
      error: Command "g++ -pthread -DNDEBUG -O2 -fPIC -DPOCKETFFT_PTHREADS -I/home/user/pypy37-venv/include/site/python3.7 -I/home/user/pypy37-venv/include/site/python3.7 -I/tmp/pip-build-env-xw64l04m/overlay/site-packages/numpy/core/include -I/home/user/pypy37-venv/include -I/home/user/pypy37/include -c scipy/fft/_pocketfft/pypocketfft.cxx -o build/temp.linux-x86_64-3.7/scipy/fft/_pocketfft/pypocketfft.o -MMD -MF build/temp.linux-x86_64-3.7/scipy/fft/_pocketfft/pypocketfft.o.d -std=c++14 -fvisibility=hidden" failed with exit status 1
    

  4. Log in to comment