在 M1 Mac 上找不到 PyTables 的 HDF5 安装

Bn.*_*F76 15 homebrew hdf5 pytables

在 M1 Mac、macOS Monterey 上运行12.4,Python 3.10.3

\n

pip install tables

\n
Collecting tables\n  Using cached tables-3.7.0.tar.gz (8.2 MB)\n  Installing build dependencies ... done\n  Getting requirements to build wheel ... error\n  error: subprocess-exited-with-error\n  \n  \xc3\x97 Getting requirements to build wheel did not run successfully.\n  \xe2\x94\x82 exit code: 1\n  \xe2\x95\xb0\xe2\x94\x80> [12 lines of output]\n      /var/folders/6g/9c7g_2tx2sb7lp8ttwtfky640000gn/T/H5closew_79lujq.c:2:5: error: implicit declaration of function \'H5close\' is invalid in C99 [-Werror,-Wimplicit-function-declaration]\n          H5close();\n          ^\n      1 error generated.\n      cpuinfo failed, assuming no CPU features: No module named \'cpuinfo\'\n      * Using Python 3.10.3 (v3.10.3:a342a49189, Mar 16 2022, 09:34:18) [Clang 13.0.0 (clang-1300.0.29.30)]\n      * Found cython 0.29.30\n      * USE_PKGCONFIG: False\n      .. ERROR:: Could not find a local HDF5 installation.\n         You may need to explicitly state where your local HDF5 headers and\n         library can be found by setting the ``HDF5_DIR`` environment\n         variable or by using the ``--hdf5`` command-line option.\n      [end of output]\n  \n  note: This error originates from a subprocess, and is likely not a problem with pip.\nerror: subprocess-exited-with-error\n\n\xc3\x97 Getting requirements to build wheel did not run successfully.\n\xe2\x94\x82 exit code: 1\n\xe2\x95\xb0\xe2\x94\x80> See above for output.\n\nnote: This error originates from a subprocess, and is likely not a problem with pip.\n
Run Code Online (Sandbox Code Playgroud)\n

我在这个 GitHub Issue 中尝试了以下操作:

\n
pip install cython\nbrew install hdf5\nbrew install c-blosc\nexport HDF5_DIR=/usr/local/\nexport BLOSC_DIR=/usr/local/\npip install tables\n
Run Code Online (Sandbox Code Playgroud)\n

但仍然遇到同样的错误。不确定这是否是由于 Homebrew 在 M1 Mac 上使用了不同的路径所致?

\n

Bn.*_*F76 28

The issue is that Homebrew puts the files in opt/homebrew/opt/

This fixed it for me:

export HDF5_DIR=/opt/homebrew/opt/hdf5 
export BLOSC_DIR=/opt/homebrew/opt/c-blosc
Run Code Online (Sandbox Code Playgroud)


yem*_*emy 12

再次完成以消除混乱。在 Mac M1 上的终端中运行以下命令应该可以工作。

pip install cython
brew install hdf5
brew install c-blosc
export HDF5_DIR=/opt/homebrew/opt/hdf5 
export BLOSC_DIR=/opt/homebrew/opt/c-blosc
pip install tables
Run Code Online (Sandbox Code Playgroud)