12

Running on 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.

I tried the following from this GitHub Issue:

pip install cython
brew install hdf5
brew install c-blosc
export HDF5_DIR=/usr/local/
export BLOSC_DIR=/usr/local/
pip install tables

But still getting the same error. Not sure if it's due to Homebrew using a different path on M1 Macs?

Bn.F76
  • 783
  • 2
  • 12
  • 30
  • 1
    I had the same issue I did install the old Python 3.8 and set the compile version as 3.8. Then it worked. This is a related conversation :https://github.com/PyTables/PyTables/issues/823 – Dilanka Fernando Oct 28 '22 at 16:06

5 Answers5

19

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
Bn.F76
  • 783
  • 2
  • 12
  • 30
9

Again in completion to remove confusion. Running the following in terminal on Mac M1 should work.

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
Max Hager
  • 536
  • 4
  • 13
0

I wanted to avoid homebrew, so the best solution I found was to install Anaconda. Anaconda Download page.

Then use:

conda install h5py

This installs the Hdf5 libraries to the system, and allows tables to be installed even outside conda environments.

After that:

pip3 install tables

Worked in every environment I have used with my python.org installed python versions.

Zim
  • 410
  • 4
  • 13
0

After installing HDF5 and c-blosc, and exporting needed environment variables, as @Max Hager wrote, the installation still did not work.

Installing from source did work though:

pip3 install git+https://github.com/PyTables/PyTables

Hope that helps. (Mac M1)

Gal Shahar
  • 2,695
  • 1
  • 21
  • 29
-1

A solution from here solved the issue for me:

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

Scroll down and see "solution" provided by camxus

vw511
  • 171
  • 10