使用 python 3.11 安装 PyTables 在 macOS M1 上失败

问题描述 投票:0回答:2
$ python -m pip install tables

停止于

错误:编译 Cython 文件

环境我位于使用 pyenv 创建的虚拟环境中。

atm 只安装了几个软件包

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

我的出口

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

这是完整的错误消息:

$ 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]

到目前为止我调查了什么

H5Ewalk() 已重命名为 H5Ewalk1() 并在 1.8.0 中弃用,如下所述: https://docs.hdfgroup.org/hdf5/develop/group___h5_e.html#title29

我使用1.14.1,所以我不太明白构建似乎使用了这个已弃用的函数?

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

测试表3.7.0

这个版本不会出现上述错误,而是在我的requirements.txt文件包安装的以下步骤中出现:

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

Github 问题之后,我尝试构建和安装最新版本的表,如下所示:

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

然后,表的测试套件失败并显示:

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'
python macos cython hdf5 pytables
2个回答
3
投票

我成功重现了您的问题,问题似乎是从 PyPi 安装软件包。从错误消息看来,Cython 找不到

lzo
库。

提到的 GitHub 线程的解决方案似乎正在安装

c-blosc
,这也没有解决我的问题。

有两种对我有用的选择:

  • 从 GitHub 安装软件包
pip3 install git+https://github.com/PyTables/PyTables
  • 使用 conda 安装包
conda install -c anaconda pytables

0
投票

我尝试再次安装虚拟环境,再次删除现有的,更新pip,并尝试各种解决方案,但这个方法解决了它......我仍然不明白原因,如果它是m1的问题,但谢谢!

© www.soinside.com 2019 - 2024. All rights reserved.