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

问题描述 投票:0回答:5

在 M1 Mac、macOS Monterey 上运行

12.4
Python 3.10.3

pip install tables

Collecting tables
  Using cached tables-3.7.0.tar.gz (8.2 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
  ╰─> [12 lines of output]
      /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]
          H5close();
          ^
      1 error generated.
      cpuinfo failed, assuming no CPU features: No module named 'cpuinfo'
      * Using Python 3.10.3 (v3.10.3:a342a49189, Mar 16 2022, 09:34:18) [Clang 13.0.0 (clang-1300.0.29.30)]
      * Found cython 0.29.30
      * USE_PKGCONFIG: False
      .. ERROR:: Could not find a local HDF5 installation.
         You may need to explicitly state where your local HDF5 headers and
         library can be found by setting the ``HDF5_DIR`` environment
         variable or by using the ``--hdf5`` command-line option.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

尝试了以下 GitHub 问题:

pip install cython brew install hdf5 brew install c-blosc export HDF5_DIR=/usr/local/ export BLOSC_DIR=/usr/local/ pip install tables
但仍然遇到同样的错误。不确定这是否是由于 Homebrew 在 M1 Mac 上使用了不同的路径所致?

homebrew hdf5 pytables
5个回答
19
投票
问题是 Homebrew 将文件放入

opt/homebrew/opt/


这为我解决了这个问题:

export HDF5_DIR=/opt/homebrew/opt/hdf5 export BLOSC_DIR=/opt/homebrew/opt/c-blosc
    

9
投票
再次完成以消除混乱。在 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
    

0
投票
我想避免自制程序,所以我发现最好的解决方案是安装 Anaconda。

Anaconda 下载页面。

然后使用:

conda install h5py
这会将 Hdf5 库安装到系统中,并允许安装表

甚至在 conda 环境之外

之后:

pip3 install tables
在我使用过的所有环境中都可以使用我的 python.org 安装的 python 版本。


0
投票
安装 HDF5 和 c-blosc 并导出所需的环境变量后,正如 @Max Hager 所写,安装仍然无法正常工作。

从源代码安装确实有效:

pip3 install git+https://github.com/PyTables/PyTables
希望有帮助。 (Mac M1)


-1
投票
这里的解决方案解决了我的问题:

https://github.com/freqtrade/freqtrade/issues/4162

向下滚动并查看

camxus

提供的“解决方案”
    

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