Search code examples
pythonmacoscythonhdf5pytables

PyTables install with python 3.11 fails on macOS M1


$ python -m pip install tables

stops with

Error: compiling Cython file

Environment (I am within a virtual environment, created with pyenv. )

Only few packages installed atm

Package    Version
---------- -------
Cython     3.0.0
numpy      1.25.1
pip        23.2.1
setuptools 65.5.0
wheel      0.41.0

My exports

export HDF5_DIR="$(brew --prefix hdf5)"
export BLOSC_DIR="$(brew --prefix c-blosc)"
export C_INCLUDE_PATH=/opt/homebrew/Cellar/lzo/2.10/include/lzo:/opt/homebrew/Cellar/lzo/2.10/include/
export LIBRARY_PATH=/opt/homebrew/lib

Here is the complete error message:

$ python -m pip install tables                                                                                                                                                                                                        ─╯
Collecting tables
  Using cached tables-3.8.0.tar.gz (8.0 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [51 lines of output]
      <string>:19: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

      Error compiling Cython file:
      ------------------------------------------------------------
      ...


      def _dump_h5_backtrace():
          cdef object bt = []

          if H5Ewalk(H5E_DEFAULT, H5E_WALK_DOWNWARD, e_walk_cb, <void*>bt) < 0:
                                                     ^
      ------------------------------------------------------------

      tables/utilsextension.pyx:384:47: Cannot assign type 'herr_t (unsigned int, const H5E_error_t *, void *) except? -1 nogil' to 'H5E_walk_t'
      cpuinfo failed, assuming no CPU features: 'flags'
      * Using Python 3.11.4 (main, Jul 27 2023, 14:26:12) [Clang 14.0.3 (clang-1403.0.22.14.1)]
      * Found cython 3.0.0
      * USE_PKGCONFIG: False
      * Found HDF5 headers at ``/opt/homebrew/opt/hdf5/include``, library at ``/opt/homebrew/opt/hdf5/lib``.
      * Found LZO 2 headers at ``/opt/homebrew/Cellar/lzo/2.10/include``, the library is located in the standard system search dirs.
      * Skipping detection of LZO 1 since LZO 2 has already been found.
      * Found bzip2 headers at ``/opt/homebrew/opt/bzip2/include``, library at ``/opt/homebrew/opt/bzip2/lib``.
      * Found blosc headers at ``/opt/homebrew/opt/c-blosc/include``, library at ``/opt/homebrew/opt/c-blosc/lib``.
      * Found blosc2 headers at ``/private/var/folders/h2/tcw923v140sbnqcz0p0xp3y80000gp/T/pip-build-env-n4mpp65u/overlay/include``, library at ``/private/var/folders/h2/tcw923v140sbnqcz0p0xp3y80000gp/T/pip-build-env-n4mpp65u/overlay/lib``.
        * Copying blosc2 runtime library to 'tables' dir because it was not found in standard locations
      Compiling tables/utilsextension.pyx because it changed.
      [1/1] Cythonizing tables/utilsextension.pyx
      Traceback (most recent call last):
        File "/Users/mario.theuermann/.pyenv/versions/i4SEE-sandbox/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/mario.theuermann/.pyenv/versions/i4SEE-sandbox/lib/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 "/Users/mario.theuermann/.pyenv/versions/i4SEE-sandbox/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/h2/tcw923v140sbnqcz0p0xp3y80000gp/T/pip-build-env-n4mpp65u/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/h2/tcw923v140sbnqcz0p0xp3y80000gp/T/pip-build-env-n4mpp65u/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/h2/tcw923v140sbnqcz0p0xp3y80000gp/T/pip-build-env-n4mpp65u/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 928, in <module>
        File "<string>", line 923, in get_cython_extfiles
        File "/private/var/folders/h2/tcw923v140sbnqcz0p0xp3y80000gp/T/pip-build-env-n4mpp65u/overlay/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
          cythonize_one(*args)
        File "/private/var/folders/h2/tcw923v140sbnqcz0p0xp3y80000gp/T/pip-build-env-n4mpp65u/overlay/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: tables/utilsextension.pyx
      [end of output]

What I investigated so far

H5Ewalk() was renamed to H5Ewalk1() and deprecated in 1.8.0 as stated here: https://docs.hdfgroup.org/hdf5/develop/group___h5_e.html#title29

I use 1.14.1, so I don't really understand that the build seems to to use this deprecated function?

$ brew info hdf5                                                                                                                                                                                                                      
==> hdf5: stable 1.14.1 (bottled)

Test tables 3.7.0

This version does not result in the above error, but in the following step of my requirements.txt file package installation:

Building wheels for collected packages: lxml, python-pptx, simplekml, tables, timezonefinder
  Building wheel for lxml (setup.py) ... done
  Created wheel for lxml: filename=lxml-4.9.2-cp311-cp311-macosx_13_0_arm64.whl size=1642538 sha256=00fdcd8bd9a533750afc5c27015d13fc99e25cad31f7f8d91b200cd4806ca7ef
  Stored in directory: /Users/mario.theuermann/Library/Caches/pip/wheels/fb/5b/f7/0a27880b4a007daeff53a196d01901627f640392b7e76e76e5
  Building wheel for python-pptx (setup.py) ... done
  Created wheel for python-pptx: filename=python_pptx-0.6.21-py3-none-any.whl size=470934 sha256=05c7f46456d4ab5df20c574b3b051386e6965af187d1b31ee469b01d5e42f144
  Stored in directory: /Users/mario.theuermann/Library/Caches/pip/wheels/f4/c7/af/d1d91f3decfaa7621033f30b69a29bf0b1206005663d233e7a
  Building wheel for simplekml (setup.py) ... done
  Created wheel for simplekml: filename=simplekml-1.3.6-py3-none-any.whl size=65860 sha256=1c1b2052ef80cfc795ba6a281a718c7a338a10723bd388c18b6910ce40356f0c
  Stored in directory: /Users/mario.theuermann/Library/Caches/pip/wheels/72/3e/80/c3e5c354c3cbe62d8c5e4fb63d9e7cdccc7f93399997ae465f
  Building wheel for tables (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for tables (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [296 lines of output]
      <string>:18: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
      cpuinfo failed, assuming no CPU features: No module named 'cpuinfo'
      * Using Python 3.11.4 (main, Jul 27 2023, 14:26:12) [Clang 14.0.3 (clang-1403.0.22.14.1)]
      * Found cython 3.0.0
      * USE_PKGCONFIG: False
      * Found HDF5 headers at ``/opt/homebrew/opt/hdf5/include``, library at ``/opt/homebrew/opt/hdf5/lib``.
      * Found LZO 2 headers at ``/opt/homebrew/Cellar/lzo/2.10/include``, the library is located in the standard system search dirs.
      * Skipping detection of LZO 1 since LZO 2 has already been found.
      * Found bzip2 headers at ``/opt/homebrew/opt/bzip2/include``, library at ``/opt/homebrew/opt/bzip2/lib``.
      * Found blosc headers at ``/opt/homebrew/opt/c-blosc/include``, library at ``/opt/homebrew/opt/c-blosc/lib``.
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-13.4-arm64-cpython-311
      creating build/lib.macosx-13.4-arm64-cpython-311/tables
      copying tables/link.py -> build/lib.macosx-13.4-arm64-cpython-311/tables
      copying tables/description.py -> build/lib.macosx-13.4-arm64-cpython-311/tables
      copying tables/index.py -> build/lib.macosx-13.4-arm64-cpython-311/tables
      copying tables/attributeset.py -> build/lib.macosx-13.4-arm64-cpython-311/tables
      copying tables/registry.py -> build/lib.macosx-13.4-arm64-cpython-311/tables
      copying tables/leaf.py -> build/lib.macosx-13.4-arm64-cpython-311/tables
      copying tables/carray.py -> build/lib.macosx-13.4-arm64-cpython-311/tables
      copying tables/__init__.py -> build/lib.macosx-13.4-arm64-cpython-311/tables
      copying tables/unimplemented.py -> build/lib.macosx-13.4-arm64-cpython-311/tables

.
.
.
.
.
      running build_ext
      building 'tables.utilsextension' extension
      creating build/temp.macosx-13.4-arm64-cpython-311/hdf5-blosc
      creating build/temp.macosx-13.4-arm64-cpython-311/hdf5-blosc/src
      creating build/temp.macosx-13.4-arm64-cpython-311/src
      creating build/temp.macosx-13.4-arm64-cpython-311/tables
      clang -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/opt/homebrew/opt/bzip2/include -DNDEBUG=1 -DHAVE_LZO2_LIB=1 -DHAVE_BZ2_LIB=1 -DHAVE_BLOSC_LIB=1 -Ihdf5-blosc/src -I/opt/homebrew/Cellar/lzo/2.10/include/lzo -I/opt/homebrew/Cellar/lzo/2.10/include -I/opt/homebrew/opt/bzip2/include -I/usr/local/include -I/sw/include -I/opt/include -I/opt/local/include -I/usr/include -I/include -I/opt/homebrew/opt/hdf5/include -I/opt/homebrew/opt/c-blosc/include -I/private/var/folders/h2/tcw923v140sbnqcz0p0xp3y80000gp/T/pip-build-env-kvflwhff/overlay/lib/python3.11/site-packages/numpy/core/include -I/Users/mario.theuermann/.pyenv/versions/i4SEE-sandbox/include -I/Users/mario.theuermann/.pyenv/versions/3.11.4/include/python3.11 -c hdf5-blosc/src/blosc_filter.c -o build/temp.macosx-13.4-arm64-cpython-311/hdf5-blosc/src/blosc_filter.o -Isrc -DH5_USE_18_API -DH5Acreate_vers=2 -DH5Aiterate_vers=2 -DH5Dcreate_vers=2 -DH5Dopen_vers=2 -DH5Eclear_vers=2 -DH5Eprint_vers=2 -DH5Epush_vers=2 -DH5Eset_auto_vers=2 -DH5Eget_auto_vers=2 -DH5Ewalk_vers=2 -DH5E_auto_t_vers=2 -DH5Gcreate_vers=2 -DH5Gopen_vers=2 -DH5Pget_filter_vers=2 -DH5Pget_filter_by_id_vers=2 -DH5Tarray_create_vers=2 -DH5Tget_array_dims_vers=2 -DH5Z_class_t_vers=2 -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
      clang -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/opt/homebrew/opt/bzip2/include -DNDEBUG=1 -DHAVE_LZO2_LIB=1 -DHAVE_BZ2_LIB=1 -DHAVE_BLOSC_LIB=1 -Ihdf5-blosc/src -I/opt/homebrew/Cellar/lzo/2.10/include/lzo -I/opt/homebrew/Cellar/lzo/2.10/include -I/opt/homebrew/opt/bzip2/include -I/usr/local/include -I/sw/include -I/opt/include -I/opt/local/include -I/usr/include -I/include -I/opt/homebrew/opt/hdf5/include -I/opt/homebrew/opt/c-blosc/include -I/private/var/folders/h2/tcw923v140sbnqcz0p0xp3y80000gp/T/pip-build-env-kvflwhff/overlay/lib/python3.11/site-packages/numpy/core/include -I/Users/mario.theuermann/.pyenv/versions/i4SEE-sandbox/include -I/Users/mario.theuermann/.pyenv/versions/3.11.4/include/python3.11 -c src/H5ARRAY.c -o build/temp.macosx-13.4-arm64-cpython-311/src/H5ARRAY.o -Isrc -DH5_USE_18_API -DH5Acreate_vers=2 -DH5Aiterate_vers=2 -DH5Dcreate_vers=2 -DH5Dopen_vers=2 -DH5Eclear_vers=2 -DH5Eprint_vers=2 -DH5Epush_vers=2 -DH5Eset_auto_vers=2 -DH5Eget_auto_vers=2 -DH5Ewalk_vers=2 -DH5E_auto_t_vers=2 -DH5Gcreate_vers=2 -DH5Gopen_vers=2 -DH5Pget_filter_vers=2 -DH5Pget_filter_by_id_vers=2 -DH5Tarray_create_vers=2 -DH5Tget_array_dims_vers=2 -DH5Z_class_t_vers=2 -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
      clang -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/opt/homebrew/opt/bzip2/include -DNDEBUG=1 -DHAVE_LZO2_LIB=1 -DHAVE_BZ2_LIB=1 -DHAVE_BLOSC_LIB=1 -Ihdf5-blosc/src -I/opt/homebrew/Cellar/lzo/2.10/include/lzo -I/opt/homebrew/Cellar/lzo/2.10/include -I/opt/homebrew/opt/bzip2/include -I/usr/local/include -I/sw/include -I/opt/include -I/opt/local/include -I/usr/include -I/include -I/opt/homebrew/opt/hdf5/include -I/opt/homebrew/opt/c-blosc/include -I/private/var/folders/h2/tcw923v140sbnqcz0p0xp3y80000gp/T/pip-build-env-kvflwhff/overlay/lib/python3.11/site-packages/numpy/core/include -I/Users/mario.theuermann/.pyenv/versions/i4SEE-sandbox/include -I/Users/mario.theuermann/.pyenv/versions/3.11.4/include/python3.11 -c src/H5ATTR.c -o build/temp.macosx-13.4-arm64-cpython-311/src/H5ATTR.o -Isrc -DH5_USE_18_API -DH5Acreate_vers=2 -DH5Aiterate_vers=2 -DH5Dcreate_vers=2 -DH5Dopen_vers=2 -DH5Eclear_vers=2 -DH5Eprint_vers=2 -DH5Epush_vers=2 -DH5Eset_auto_vers=2 -DH5Eget_auto_vers=2 -DH5Ewalk_vers=2 -DH5E_auto_t_vers=2 -DH5Gcreate_vers=2 -DH5Gopen_vers=2 -DH5Pget_filter_vers=2 -DH5Pget_filter_by_id_vers=2 -DH5Tarray_create_vers=2 -DH5Tget_array_dims_vers=2 -DH5Z_class_t_vers=2 -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
      src/H5ATTR.c:453:8: warning: explicitly assigning value of variable of type 'hid_t' (aka 'long long') to itself [-Wself-assign]
       loc_id=loc_id;
       ~~~~~~^~~~~~~
      1 warning generated.
      clang -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/opt/homebrew/opt/bzip2/include -DNDEBUG=1 -DHAVE_LZO2_LIB=1 -DHAVE_BZ2_LIB=1 -DHAVE_BLOSC_LIB=1 -Ihdf5-blosc/src -I/opt/homebrew/Cellar/lzo/2.10/include/lzo -I/opt/homebrew/Cellar/lzo/2.10/include -I/opt/homebrew/opt/bzip2/include -I/usr/local/include -I/sw/include -I/opt/include -I/opt/local/include -I/usr/include -I/include -I/opt/homebrew/opt/hdf5/include -I/opt/homebrew/opt/c-blosc/include -I/private/var/folders/h2/tcw923v140sbnqcz0p0xp3y80000gp/T/pip-build-env-kvflwhff/overlay/lib/python3.11/site-packages/numpy/core/include -I/Users/mario.theuermann/.pyenv/versions/i4SEE-sandbox/include -I/Users/mario.theuermann/.pyenv/versions/3.11.4/include/python3.11 -c src/utils.c -o build/temp.macosx-13.4-arm64-cpython-311/src/utils.o -Isrc -DH5_USE_18_API -DH5Acreate_vers=2 -DH5Aiterate_vers=2 -DH5Dcreate_vers=2 -DH5Dopen_vers=2 -DH5Eclear_vers=2 -DH5Eprint_vers=2 -DH5Epush_vers=2 -DH5Eset_auto_vers=2 -DH5Eget_auto_vers=2 -DH5Ewalk_vers=2 -DH5E_auto_t_vers=2 -DH5Gcreate_vers=2 -DH5Gopen_vers=2 -DH5Pget_filter_vers=2 -DH5Pget_filter_by_id_vers=2 -DH5Tarray_create_vers=2 -DH5Tget_array_dims_vers=2 -DH5Z_class_t_vers=2 -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
      src/utils.c:290:14: warning: variable 'namedtypes' set but not used [-Wunused-but-set-variable]
        int        namedtypes = 0;
                   ^
      1 warning generated.
      clang -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/opt/homebrew/opt/bzip2/include -DNDEBUG=1 -DHAVE_LZO2_LIB=1 -DHAVE_BZ2_LIB=1 -DHAVE_BLOSC_LIB=1 -Ihdf5-blosc/src -I/opt/homebrew/Cellar/lzo/2.10/include/lzo -I/opt/homebrew/Cellar/lzo/2.10/include -I/opt/homebrew/opt/bzip2/include -I/usr/local/include -I/sw/include -I/opt/include -I/opt/local/include -I/usr/include -I/include -I/opt/homebrew/opt/hdf5/include -I/opt/homebrew/opt/c-blosc/include -I/private/var/folders/h2/tcw923v140sbnqcz0p0xp3y80000gp/T/pip-build-env-kvflwhff/overlay/lib/python3.11/site-packages/numpy/core/include -I/Users/mario.theuermann/.pyenv/versions/i4SEE-sandbox/include -I/Users/mario.theuermann/.pyenv/versions/3.11.4/include/python3.11 -c tables/utilsextension.c -o build/temp.macosx-13.4-arm64-cpython-311/tables/utilsextension.o -Isrc -DH5_USE_18_API -DH5Acreate_vers=2 -DH5Aiterate_vers=2 -DH5Dcreate_vers=2 -DH5Dopen_vers=2 -DH5Eclear_vers=2 -DH5Eprint_vers=2 -DH5Epush_vers=2 -DH5Eset_auto_vers=2 -DH5Eget_auto_vers=2 -DH5Ewalk_vers=2 -DH5E_auto_t_vers=2 -DH5Gcreate_vers=2 -DH5Gopen_vers=2 -DH5Pget_filter_vers=2 -DH5Pget_filter_by_id_vers=2 -DH5Tarray_create_vers=2 -DH5Tget_array_dims_vers=2 -DH5Z_class_t_vers=2 -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
      tables/utilsextension.c:8032:52: warning: comparison of integers of different signs: 'hsize_t' (aka 'unsigned long long') and 'long long' [-Wsign-compare]
              __pyx_t_2 = (((__pyx_v_maxdims[__pyx_v_i]) == -1LL) != 0);
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~  ^  ~~~~
      tables/utilsextension.c:12367:33: warning: comparison of integers of different signs: 'int' and 'hsize_t' (aka 'unsigned long long') [-Wsign-compare]
        for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
                            ~~~~~~~~~ ^ ~~~~~~~~~
      tables/utilsextension.c:15186:35: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
          for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
                              ~~~~~~~~~ ^ ~~~~~~~~~
      tables/utilsextension.c:15413:52: warning: comparison of integers of different signs: 'hsize_t' (aka 'unsigned long long') and 'long long' [-Wsign-compare]
              __pyx_t_3 = (((__pyx_v_maxdims[__pyx_v_j]) == -1LL) != 0);
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~  ^  ~~~~
      tables/utilsextension.c:22030:23: error: no member named 'exc_type' in 'struct _err_stackitem'
          while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
                  ~~~~~~~~  ^
      tables/utilsextension.c:22030:53: error: no member named 'exc_type' in 'struct _err_stackitem'
          while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
                                                ~~~~~~~~  ^
      tables/utilsextension.c:22044:23: error: no member named 'exc_type' in 'struct _err_stackitem'
          *type = exc_info->exc_type;
                  ~~~~~~~~  ^
      tables/utilsextension.c:22046:21: error: no member named 'exc_traceback' in 'struct _err_stackitem'
          *tb = exc_info->exc_traceback;
                ~~~~~~~~  ^
      tables/utilsextension.c:22060:26: error: no member named 'exc_type' in 'struct _err_stackitem'
          tmp_type = exc_info->exc_type;
                     ~~~~~~~~  ^
      tables/utilsextension.c:22062:24: error: no member named 'exc_traceback' in 'struct _err_stackitem'
          tmp_tb = exc_info->exc_traceback;
                   ~~~~~~~~  ^
      tables/utilsextension.c:22063:15: error: no member named 'exc_type' in 'struct _err_stackitem'
          exc_info->exc_type = type;
          ~~~~~~~~  ^
      tables/utilsextension.c:22065:15: error: no member named 'exc_traceback' in 'struct _err_stackitem'
          exc_info->exc_traceback = tb;
          ~~~~~~~~  ^
      tables/utilsextension.c:22147:30: error: no member named 'exc_type' in 'struct _err_stackitem'
              tmp_type = exc_info->exc_type;
                         ~~~~~~~~  ^
      tables/utilsextension.c:22149:28: error: no member named 'exc_traceback' in 'struct _err_stackitem'
              tmp_tb = exc_info->exc_traceback;
                       ~~~~~~~~  ^
      tables/utilsextension.c:22150:19: error: no member named 'exc_type' in 'struct _err_stackitem'
              exc_info->exc_type = local_type;
              ~~~~~~~~  ^
      tables/utilsextension.c:22152:19: error: no member named 'exc_traceback' in 'struct _err_stackitem'
              exc_info->exc_traceback = local_tb;
              ~~~~~~~~  ^
      tables/utilsextension.c:22201:43: warning: 'ob_shash' is deprecated [-Wdeprecated-declarations]
                  hash1 = ((PyBytesObject*)s1)->ob_shash;
                                                ^
      /Users/mario.theuermann/.pyenv/versions/3.11.4/include/python3.11/cpython/bytesobject.h:7:5: note: 'ob_shash' has been explicitly marked deprecated here
          Py_DEPRECATED(3.11) Py_hash_t ob_shash;
          ^
      /Users/mario.theuermann/.pyenv/versions/3.11.4/include/python3.11/pyport.h:336:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      tables/utilsextension.c:22202:43: warning: 'ob_shash' is deprecated [-Wdeprecated-declarations]
                  hash2 = ((PyBytesObject*)s2)->ob_shash;
                                                ^
      /Users/mario.theuermann/.pyenv/versions/3.11.4/include/python3.11/cpython/bytesobject.h:7:5: note: 'ob_shash' has been explicitly marked deprecated here
          Py_DEPRECATED(3.11) Py_hash_t ob_shash;
          ^
      /Users/mario.theuermann/.pyenv/versions/3.11.4/include/python3.11/pyport.h:336:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      tables/utilsextension.c:22347:26: error: no member named 'exc_type' in 'struct _err_stackitem'
          tmp_type = exc_info->exc_type;
                     ~~~~~~~~  ^
      tables/utilsextension.c:22349:24: error: no member named 'exc_traceback' in 'struct _err_stackitem'
          tmp_tb = exc_info->exc_traceback;
                   ~~~~~~~~  ^
      tables/utilsextension.c:22350:15: error: no member named 'exc_type' in 'struct _err_stackitem'
          exc_info->exc_type = *type;
          ~~~~~~~~  ^
      tables/utilsextension.c:22352:15: error: no member named 'exc_traceback' in 'struct _err_stackitem'
          exc_info->exc_traceback = *tb;
          ~~~~~~~~  ^
      tables/utilsextension.c:23020:5: error: incomplete definition of type 'struct _frame'
          __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      tables/utilsextension.c:445:62: note: expanded from macro '__Pyx_PyFrame_SetLineNumber'
        #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
                                                            ~~~~~~~^
      /Users/mario.theuermann/.pyenv/versions/3.11.4/include/python3.11/pytypedefs.h:22:16: note: forward declaration of 'struct _frame'
      typedef struct _frame PyFrameObject;
                     ^
      6 warnings and 17 errors generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for tables
  Building wheel for timezonefinder (pyproject.toml) ... done

Following the Github issue I tried building and installing the latest version of tables like so:

python setup.py build --hdf5=/opt/homebrew/opt/hdf5 --use-pkgconfig=FALSE --blosc=/opt/homebrew/opt/c-blosc --lzo=/opt/homebrew/Cellar/lzo/2.10 --bzip2=/opt/homebrew/Cellar/bzip2/1.0.8

python setup.py install --hdf5=/opt/homebrew/opt/hdf5

Then, the test suite of tables fails with:

python3 -m tables.tests.test_all                                                                                                                                                                              ─╯
Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen runpy>", line 112, in _get_module_details
  File "/Users/xyz/projects-my/PyTables/tables/__init__.py", line 42, in <module>
    from .utilsextension import get_hdf5_version as _get_hdf5_version
ModuleNotFoundError: No module named 'tables.utilsextension'

Solution

  • I managed to reproduce your issue, the problem seems to be installing the package from PyPi. From the error message it seems the Cython cannot find lzo libraries.

    The solution of the mentioned GitHub thread seems to be installing c-blosc, which also did not fix the problem for me.

    There are two options that worked for me:

    • install the package from GitHub
    pip3 install git+https://github.com/PyTables/PyTables
    
    • install the package using conda
    conda install -c anaconda pytables