Error installing tsflex on Mac: "Failed building wheel for fastparquet"

131 Views Asked by At

I've come across an issue while attempting to install the tsflex package on my Mac using pip3. After running pip3 install tsflex, I received the following error message:

Collecting tsflex
  Using cached tsflex-0.1.1.9-py3-none-any.whl (50 kB)
Collecting dill<0.4.0,>=0.3.3 (from tsflex)
  Using cached dill-0.3.6-py3-none-any.whl (110 kB)
Collecting fastparquet<0.7.0,>=0.6.3 (from tsflex)
  Using cached fastparquet-0.6.3.tar.gz (318 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy<2.0.0,>=1.19.0 in /opt/homebrew/lib/python3.11/site-packages (from tsflex) (1.24.3)
Collecting pandas<2.0.0,>=1.2.3 (from tsflex)
  Using cached pandas-1.5.3-cp311-cp311-macosx_11_0_arm64.whl (10.8 MB)
Collecting pathos<0.3.0,>=0.2.7 (from tsflex)
  Using cached pathos-0.2.9-py3-none-any.whl (76 kB)
Collecting tqdm<5.0.0,>=4.60.0 (from tsflex)
  Using cached tqdm-4.65.0-py3-none-any.whl (77 kB)
Collecting thrift>=0.11.0 (from fastparquet<0.7.0,>=0.6.3->tsflex)
  Using cached thrift-0.16.0-cp311-cp311-macosx_13_0_arm64.whl
Requirement already satisfied: cramjam>=2.3.0 in /opt/homebrew/lib/python3.11/site-packages (from fastparquet<0.7.0,>=0.6.3->tsflex) (2.6.2)
Requirement already satisfied: fsspec in /opt/homebrew/lib/python3.11/site-packages (from fastparquet<0.7.0,>=0.6.3->tsflex) (2023.5.0)
Requirement already satisfied: python-dateutil>=2.8.1 in /opt/homebrew/lib/python3.11/site-packages (from pandas<2.0.0,>=1.2.3->tsflex) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in /opt/homebrew/lib/python3.11/site-packages (from pandas<2.0.0,>=1.2.3->tsflex) (2023.3)
Collecting ppft>=1.7.6.5 (from pathos<0.3.0,>=0.2.7->tsflex)
  Using cached ppft-1.7.6.6-py3-none-any.whl (52 kB)
Collecting pox>=0.3.1 (from pathos<0.3.0,>=0.2.7->tsflex)
  Using cached pox-0.3.2-py3-none-any.whl (29 kB)
Collecting multiprocess>=0.70.13 (from pathos<0.3.0,>=0.2.7->tsflex)
  Using cached multiprocess-0.70.14-py310-none-any.whl (134 kB)
Requirement already satisfied: six>=1.5 in /opt/homebrew/lib/python3.11/site-packages (from python-dateutil>=2.8.1->pandas<2.0.0,>=1.2.3->tsflex) (1.16.0)
Building wheels for collected packages: fastparquet
  Building wheel for fastparquet (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [143 lines of output]
      /opt/homebrew/lib/python3.11/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!
      
              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************
      
      !!
        dist.fetch_build_eggs(dist.setup_requires)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-13-arm64-cpython-311
      creating build/lib.macosx-13-arm64-cpython-311/fastparquet
      copying fastparquet/encoding.py -> build/lib.macosx-13-arm64-cpython-311/fastparquet
      copying fastparquet/util.py -> build/lib.macosx-13-arm64-cpython-311/fastparquet
      copying fastparquet/dataframe.py -> build/lib.macosx-13-arm64-cpython-311/fastparquet
      copying fastparquet/compression.py -> build/lib.macosx-13-arm64-cpython-311/fastparquet
      copying fastparquet/thrift_structures.py -> build/lib.macosx-13-arm64-cpython-311/fastparquet
      copying fastparquet/__init__.py -> build/lib.macosx-13-arm64-cpython-311/fastparquet
      copying fastparquet/core.py -> build/lib.macosx-13-arm64-cpython-311/fastparquet
      copying fastparquet/converted_types.py -> build/lib.macosx-13-arm64-cpython-311/fastparquet
      copying fastparquet/api.py -> build/lib.macosx-13-arm64-cpython-311/fastparquet
      copying fastparquet/writer.py -> build/lib.macosx-13-arm64-cpython-311/fastparquet
      copying fastparquet/schema.py -> build/lib.macosx-13-arm64-cpython-311/fastparquet
      running egg_info
      writing fastparquet.egg-info/PKG-INFO
      writing dependency_links to fastparquet.egg-info/dependency_links.txt
      writing requirements to fastparquet.egg-info/requires.txt
      writing top-level names to fastparquet.egg-info/top_level.txt
      reading manifest file 'fastparquet.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      no previously-included directories found matching 'fastparquet/test/'
      no previously-included directories found matching 'fastparquet/benchmarks/'
      no previously-included directories found matching 'test-data/'
      no previously-included directories found matching 'docs/'
      adding license file 'LICENSE'
      writing manifest file 'fastparquet.egg-info/SOURCES.txt'
      /opt/homebrew/lib/python3.11/site-packages/setuptools/command/build_py.py:201: _Warning: Package 'fastparquet.parquet_thrift' is absent from the `packages` configuration.
      !!
      
              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'fastparquet.parquet_thrift' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.
      
              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'fastparquet.parquet_thrift' is explicitly added
              to the `packages` configuration field.
      
              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).
      
              You can read more about "package discovery" on setuptools documentation page:
      
              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html
      
              If you don't want 'fastparquet.parquet_thrift' to be distributed and are
              already explicitly excluding 'fastparquet.parquet_thrift' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.
      
              You can read more about "package data files" on setuptools documentation page:
      
              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html
      
      
              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************
      
      !!
        check.warn(importable)
      /opt/homebrew/lib/python3.11/site-packages/setuptools/command/build_py.py:201: _Warning: Package 'fastparquet.parquet_thrift.parquet' is absent from the `packages` configuration.
      !!
      
              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'fastparquet.parquet_thrift.parquet' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.
      
              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'fastparquet.parquet_thrift.parquet' is explicitly added
              to the `packages` configuration field.
      
              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).
      
              You can read more about "package discovery" on setuptools documentation page:
      
              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html
      
              If you don't want 'fastparquet.parquet_thrift.parquet' to be distributed and are
              already explicitly excluding 'fastparquet.parquet_thrift.parquet' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.
      
              You can read more about "package data files" on setuptools documentation page:
      
              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html
      
      
              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************
      
      !!
        check.warn(importable)
      copying fastparquet/cencoding.c -> build/lib.macosx-13-arm64-cpython-311/fastparquet
      copying fastparquet/cencoding.pyx -> build/lib.macosx-13-arm64-cpython-311/fastparquet
      copying fastparquet/parquet.thrift -> build/lib.macosx-13-arm64-cpython-311/fastparquet
      copying fastparquet/speedups.c -> build/lib.macosx-13-arm64-cpython-311/fastparquet
      copying fastparquet/speedups.pyx -> build/lib.macosx-13-arm64-cpython-311/fastparquet
      creating build/lib.macosx-13-arm64-cpython-311/fastparquet/parquet_thrift
      copying fastparquet/parquet_thrift/__init__.py -> build/lib.macosx-13-arm64-cpython-311/fastparquet/parquet_thrift
      creating build/lib.macosx-13-arm64-cpython-311/fastparquet/parquet_thrift/parquet
      copying fastparquet/parquet_thrift/parquet/__init__.py -> build/lib.macosx-13-arm64-cpython-311/fastparquet/parquet_thrift/parquet
      copying fastparquet/parquet_thrift/parquet/constants.py -> build/lib.macosx-13-arm64-cpython-311/fastparquet/parquet_thrift/parquet
      copying fastparquet/parquet_thrift/parquet/ttypes.py -> build/lib.macosx-13-arm64-cpython-311/fastparquet/parquet_thrift/parquet
      running build_ext
      building 'fastparquet.speedups' extension
      creating build/temp.macosx-13-arm64-cpython-311
      creating build/temp.macosx-13-arm64-cpython-311/fastparquet
      clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -I/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/include/python3.11 -I/opt/homebrew/lib/python3.11/site-packages/numpy/core/include -c fastparquet/speedups.c -o build/temp.macosx-13-arm64-cpython-311/fastparquet/speedups.o
      fastparquet/speedups.c:209:12: fatal error: 'longintrepr.h' file not found
        #include "longintrepr.h"
                 ^~~~~~~~~~~~~~~
      1 error 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 fastparquet
  Running setup.py clean for fastparquet
Failed to build fastparquet
ERROR: Could not build wheels for fastparquet, which is required to install pyproject.toml-based projects

I'm using python3.9. I have Xcode Command Line Tools installed, and I also made sure that the snappy library is installed using Homebrew. I have tried upgrading pip, setuptools, Cmake, and wheel to their latest versions. However, I'm still unable to resolve the issue.

1

There are 1 best solutions below

0
mdurant On

Your error is strange... Fastparquet ships binary wheels for a number of OS and architecture mixes that ought to include yours, and so not need any local building.

Having said that, I suspect the problem is probably originating in a mix of libraries between python and whatever homebrew is doing. You could try removing the bundled C source - but this is tricky when things are hidden behind an opaque layer by the pip process.

Actually the best way to install binary things, python-specific or otherwise, is to use the conda ecosystem. This makes far more extensive account for architecture and consistency of all the related packages; for instance, it will provide its own variety of snappy rather than need you to install it via other means.