python – Legacy-install-failure in installing pmdarima on M1 Macbook Air

I ran the pip install pmdarima command, and ran across the following error. I tried searching for the cause of this error online, but I couldn’t find anything. Some websites advised to upgrade pip tools, while others told to upgrade xcode. But nothing along those lines worked.

Collecting pmdarima
  Using cached pmdarima-1.8.5.tar.gz (639 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: joblib>=0.11 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pmdarima) (1.1.0)
Requirement already satisfied: Cython!=0.29.18,>=0.29 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pmdarima) (0.29.30)
Requirement already satisfied: numpy>=1.19.3 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pmdarima) (1.23.0)
Requirement already satisfied: pandas>=0.19 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pmdarima) (1.4.1)
Requirement already satisfied: scikit-learn>=0.22 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pmdarima) (1.1.1)
Requirement already satisfied: scipy>=1.3.2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pmdarima) (1.8.1)
Requirement already satisfied: statsmodels!=0.12.0,>=0.11 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pmdarima) (0.13.2)
Requirement already satisfied: urllib3 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pmdarima) (1.26.9)
Requirement already satisfied: setuptools!=50.0.0,>=38.6.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pmdarima) (58.1.0)
Requirement already satisfied: pytz>=2020.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pandas>=0.19->pmdarima) (2022.1)
Requirement already satisfied: python-dateutil>=2.8.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pandas>=0.19->pmdarima) (2.8.2)
Requirement already satisfied: threadpoolctl>=2.0.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from scikit-learn>=0.22->pmdarima) (3.1.0)
Requirement already satisfied: packaging>=21.3 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from statsmodels!=0.12.0,>=0.11->pmdarima) (21.3)
Requirement already satisfied: patsy>=0.5.2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from statsmodels!=0.12.0,>=0.11->pmdarima) (0.5.2)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from packaging>=21.3->statsmodels!=0.12.0,>=0.11->pmdarima) (3.0.7)
Requirement already satisfied: six in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from patsy>=0.5.2->statsmodels!=0.12.0,>=0.11->pmdarima) (1.16.0)
Using legacy 'setup.py install' for pmdarima, since package 'wheel' is not installed.
Installing collected packages: pmdarima
  Running setup.py install for pmdarima ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for pmdarima did not run successfully.
  │ exit code: 1
  ╰─> [73 lines of output]
      Partial import of pmdarima during the build process.
      Requirements: ['joblib>=0.11', 'Cython>=0.29,!=0.29.18', 'numpy>=1.19.3', 'pandas>=0.19', 'scikit-learn>=0.22', 'scipy>=1.3.2', 'statsmodels>=0.11,!=0.12.0', 'urllib3', 'setuptools>=38.6.0,!=50.0.0']
      Adding extra setuptools args
      /private/var/folders/nr/hn1_wvdd2hx_2hnq4c559m4m0000gn/T/pip-install-etnsxeil/pmdarima_821802cba29a4caa9d6091039bb5d05d/setup.py:133: DeprecationWarning:
      
        `numpy.distutils` is deprecated since NumPy 1.23.0, as a result
        of the deprecation of `distutils` itself. It will be removed for
        Python >= 3.12. For older Python versions it will remain present.
        It is recommended to use `setuptools < 60.0` for those Python versions.
        For more details, see:
          https://numpy.org/devdocs/reference/distutils_status_migration.html
      
      
        from numpy.distutils.command.build_ext import build_ext  # noqa
      Setting up with numpy.distutils.core
      /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py:717: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
        warnings.warn(
      INFO: blas_opt_info:
      /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/system_info.py:845: UserWarning:
          Blas (http://www.netlib.org/blas/) libraries not found.
          Directories to search for the libraries can be specified in the
          numpy/distutils/site.cfg file (section [blas]) or by setting
          the BLAS environment variable.
        self.calc_info()
      /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/system_info.py:845: UserWarning:
          Blas (http://www.netlib.org/blas/) sources not found.
          Directories to search for the sources can be specified in the
          numpy/distutils/site.cfg file (section [blas_src]) or by setting
          the BLAS_SRC environment variable.
        self.calc_info()
      INFO:   NOT AVAILABLE
      INFO:
      INFO: C compiler: clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g
      
      INFO: compile options: '-c'
      INFO: clang: test_program.c
      xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/nr/hn1_wvdd2hx_2hnq4c559m4m0000gn/T/pip-install-etnsxeil/pmdarima_821802cba29a4caa9d6091039bb5d05d/setup.py", line 335, in <module>
          do_setup()
        File "/private/var/folders/nr/hn1_wvdd2hx_2hnq4c559m4m0000gn/T/pip-install-etnsxeil/pmdarima_821802cba29a4caa9d6091039bb5d05d/setup.py", line 331, in do_setup
          setup(**metadata)
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/core.py", line 135, in setup
          config = configuration()
        File "/private/var/folders/nr/hn1_wvdd2hx_2hnq4c559m4m0000gn/T/pip-install-etnsxeil/pmdarima_821802cba29a4caa9d6091039bb5d05d/setup.py", line 177, in configuration
          config.add_subpackage(DISTNAME)
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 1050, in add_subpackage
          config_list = self.get_subpackage(subpackage_name, subpackage_path,
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 1016, in get_subpackage
          config = self._get_configuration_from_setup_py(
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 958, in _get_configuration_from_setup_py
          config = setup_module.configuration(*args)
        File "/private/var/folders/nr/hn1_wvdd2hx_2hnq4c559m4m0000gn/T/pip-install-etnsxeil/pmdarima_821802cba29a4caa9d6091039bb5d05d/pmdarima/setup.py", line 47, in configuration
          cythonize_extensions(top_path, config)
        File "/private/var/folders/nr/hn1_wvdd2hx_2hnq4c559m4m0000gn/T/pip-install-etnsxeil/pmdarima_821802cba29a4caa9d6091039bb5d05d/pmdarima/_build_utils/__init__.py", line 66, in cythonize_extensions
          basic_check_build()
        File "/private/var/folders/nr/hn1_wvdd2hx_2hnq4c559m4m0000gn/T/pip-install-etnsxeil/pmdarima_821802cba29a4caa9d6091039bb5d05d/pmdarima/_build_utils/pre_build_helpers.py", line 74, in basic_check_build
          compile_test_program(code)
        File "/private/var/folders/nr/hn1_wvdd2hx_2hnq4c559m4m0000gn/T/pip-install-etnsxeil/pmdarima_821802cba29a4caa9d6091039bb5d05d/pmdarima/_build_utils/pre_build_helpers.py", line 43, in compile_test_program
          ccompiler.compile(['test_program.c'], output_dir="objects",
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/ccompiler.py", line 89, in <lambda>
          m = lambda self, *args, **kw: func(self, *args, **kw)
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/ccompiler.py", line 365, in CCompiler_compile
          single_compile(o)
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/ccompiler.py", line 325, in single_compile
          self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/ccompiler.py", line 89, in <lambda>
          m = lambda self, *args, **kw: func(self, *args, **kw)
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/unixccompiler.py", line 58, in UnixCCompiler__compile
          raise CompileError(msg) from None
      distutils.errors.CompileError: Command "clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -c test_program.c -o objects/test_program.o" failed with exit status 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pmdarima

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

The error itself tells me that the issue is with the package, and not the pip command, but I just wanted to make sure that there’s nothing I can do on my side.

If there’s nothing I can do, could someone please guide me to a library where I can use autoarima for time series forecasting?

Leave a Comment