如何安装 pmdarima?

How can I install pmdarima?

存在持续性错误,所有要求均已满足。

C:\Users\dobri>python -m pip install --user pmdarima
Collecting pmdarima
  Using cached https://files.pythonhosted.org/packages/1a/4f/6851c8d37551efcb8cfe12539f42f0f1b42a2d28a7275f1e1f6bdd6956a2/pmdarima-1.4.0.tar.gz
Requirement already satisfied: Cython>=0.29 in c:\users\dobri\appdata\roaming\python\python38\site-packages (from pmdarima) (0.29.14)
Requirement already satisfied: joblib>=0.11 in c:\users\dobri\appdata\roaming\python\python38\site-packages (from pmdarima) (0.14.0)
Requirement already satisfied: numpy>=1.16 in c:\users\dobri\appdata\roaming\python\python38\site-packages (from pmdarima) (1.17.4+mkl)
Requirement already satisfied: pandas>=0.19 in c:\users\dobri\appdata\roaming\python\python38\site-packages (from pmdarima) (0.25.3)
Requirement already satisfied: scikit-learn>=0.19 in c:\users\dobri\appdata\roaming\python\python38\site-packages (from pmdarima) (0.21.3)
Requirement already satisfied: scipy>=1.3 in c:\users\dobri\appdata\roaming\python\python38\site-packages (from pmdarima) (1.4.0rc1)
Requirement already satisfied: six>=1.5 in c:\users\dobri\appdata\roaming\python\python38\site-packages (from pmdarima) (1.13.0)
Requirement already satisfied: statsmodels>=0.10.0 in c:\users\dobri\appdata\roaming\python\python38\site-packages (from pmdarima) (0.10.1)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\dobri\appdata\roaming\python\python38\site-packages (from pandas>=0.19->pmdarima) (2.8.1)
Requirement already satisfied: pytz>=2017.2 in c:\users\dobri\appdata\roaming\python\python38\site-packages (from pandas>=0.19->pmdarima) (2019.3)
Requirement already satisfied: patsy>=0.4.0 in c:\users\dobri\appdata\roaming\python\python38\site-packages (from statsmodels>=0.10.0->pmdarima) (0.5.1)
Building wheels for collected packages: pmdarima
  Building wheel for pmdarima (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Program Files (x86)\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\dobri\AppData\Local\Temp\pip-install-2rok4_p8\pmdarima\setup.py'"'"'; __file__='"'"'C:\Users\dobri\AppData\Local\Temp\pip-install-2rok4_p8\pmdarima\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\dobri\AppData\Local\Temp\pip-wheel-e4h0dzsn' --python-tag cp38
       cwd: C:\Users\dobri\AppData\Local\Temp\pip-install-2rok4_p8\pmdarima\
  Complete output (28 lines):
  Partial import of pmdarima during the build process.
  Requirements: ['Cython>=0.29\njoblib>=0.11\nnumpy>=1.16\npandas>=0.19\nscikit-learn>=0.19\nscipy>=1.3\nsix>=1.5\nstatsmodels>=0.10.0\n']
  Adding extra setuptools args
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\dobri\AppData\Local\Temp\pip-install-2rok4_p8\pmdarima\setup.py", line 250, in <module>
      do_setup()
    File "C:\Users\dobri\AppData\Local\Temp\pip-install-2rok4_p8\pmdarima\setup.py", line 246, in do_setup
      setup(**metadata)
    File "C:\Users\dobri\AppData\Roaming\Python\Python38\site-packages\numpy\distutils\core.py", line 137, in setup
      config = configuration()
    File "C:\Users\dobri\AppData\Local\Temp\pip-install-2rok4_p8\pmdarima\setup.py", line 164, in configuration
      config.add_subpackage(DISTNAME)
    File "C:\Users\dobri\AppData\Roaming\Python\Python38\site-packages\numpy\distutils\misc_util.py", line 1033, in add_subpackage
      config_list = self.get_subpackage(subpackage_name, subpackage_path,
    File "C:\Users\dobri\AppData\Roaming\Python\Python38\site-packages\numpy\distutils\misc_util.py", line 999, in get_subpackage
      config = self._get_configuration_from_setup_py(
    File "C:\Users\dobri\AppData\Roaming\Python\Python38\site-packages\numpy\distutils\misc_util.py", line 941, in _get_configuration_from_setup_py
      config = setup_module.configuration(*args)
    File "pmdarima\setup.py", line 36, in configuration
      config.add_subpackage('model_selection/tests')
    File "C:\Users\dobri\AppData\Roaming\Python\Python38\site-packages\numpy\distutils\misc_util.py", line 1033, in add_subpackage
      config_list = self.get_subpackage(subpackage_name, subpackage_path,
    File "C:\Users\dobri\AppData\Roaming\Python\Python38\site-packages\numpy\distutils\misc_util.py", line 995, in get_subpackage
      config = Configuration(subpackage_name, parent_name,
    File "C:\Users\dobri\AppData\Roaming\Python\Python38\site-packages\numpy\distutils\misc_util.py", line 779, in __init__
      raise ValueError("%r is not a directory" % (package_path,))
  ValueError: 'pmdarima\model_selection\tests' is not a directory
  ----------------------------------------
  ERROR: Failed building wheel for pmdarima
  Running setup.py clean for pmdarima
Failed to build pmdarima
Installing collected packages: pmdarima
    Running setup.py install for pmdarima ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Program Files (x86)\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\dobri\AppData\Local\Temp\pip-install-2rok4_p8\pmdarima\setup.py'"'"'; __file__='"'"'C:\Users\dobri\AppData\Local\Temp\pip-install-2rok4_p8\pmdarima\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\dobri\AppData\Local\Temp\pip-record-ugu3cswz\install-record.txt' --single-version-externally-managed --compile --user --prefix=
         cwd: C:\Users\dobri\AppData\Local\Temp\pip-install-2rok4_p8\pmdarima\
    Complete output (28 lines):
    Partial import of pmdarima during the build process.
    Requirements: ['Cython>=0.29\njoblib>=0.11\nnumpy>=1.16\npandas>=0.19\nscikit-learn>=0.19\nscipy>=1.3\nsix>=1.5\nstatsmodels>=0.10.0\n']
    Adding extra setuptools args
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\dobri\AppData\Local\Temp\pip-install-2rok4_p8\pmdarima\setup.py", line 250, in <module>
        do_setup()
      File "C:\Users\dobri\AppData\Local\Temp\pip-install-2rok4_p8\pmdarima\setup.py", line 246, in do_setup
        setup(**metadata)
      File "C:\Users\dobri\AppData\Roaming\Python\Python38\site-packages\numpy\distutils\core.py", line 137, in setup
        config = configuration()
      File "C:\Users\dobri\AppData\Local\Temp\pip-install-2rok4_p8\pmdarima\setup.py", line 164, in configuration
        config.add_subpackage(DISTNAME)
      File "C:\Users\dobri\AppData\Roaming\Python\Python38\site-packages\numpy\distutils\misc_util.py", line 1033, in add_subpackage
        config_list = self.get_subpackage(subpackage_name, subpackage_path,
      File "C:\Users\dobri\AppData\Roaming\Python\Python38\site-packages\numpy\distutils\misc_util.py", line 999, in get_subpackage
        config = self._get_configuration_from_setup_py(
      File "C:\Users\dobri\AppData\Roaming\Python\Python38\site-packages\numpy\distutils\misc_util.py", line 941, in _get_configuration_from_setup_py
        config = setup_module.configuration(*args)
      File "pmdarima\setup.py", line 36, in configuration
        config.add_subpackage('model_selection/tests')
      File "C:\Users\dobri\AppData\Roaming\Python\Python38\site-packages\numpy\distutils\misc_util.py", line 1033, in add_subpackage
        config_list = self.get_subpackage(subpackage_name, subpackage_path,
      File "C:\Users\dobri\AppData\Roaming\Python\Python38\site-packages\numpy\distutils\misc_util.py", line 995, in get_subpackage
        config = Configuration(subpackage_name, parent_name,
      File "C:\Users\dobri\AppData\Roaming\Python\Python38\site-packages\numpy\distutils\misc_util.py", line 779, in __init__
        raise ValueError("%r is not a directory" % (package_path,))
    ValueError: 'pmdarima\model_selection\tests' is not a directory
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Program Files (x86)\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\dobri\AppData\Local\Temp\pip-install-2rok4_p8\pmdarima\setup.py'"'"'; __file__='"'"'C:\Users\dobri\AppData\Local\Temp\pip-install-2rok4_p8\pmdarima\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\dobri\AppData\Local\Temp\pip-record-ugu3cswz\install-record.txt' --single-version-externally-managed --compile --user --prefix= Check the logs for full command output.

2021 年更新答案

截至 2021 年,最初的 Github 问题 (Python 3.8 Support) about supporting Python 3.8 with pmdarima has been resolved (with this PR [MRG+2] Python 3.8 support) 已关闭。现在可以用pip 21.x and Python 3.8.x and pmdarima 1.8.x:

正常安装
(tmp) tmp$ python3.8 -m pip -V
pip 21.2.4 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
(tmp) tmp$ python3.8 -V
Python 3.8.12
...
Collecting pmdarima
  Using cached pmdarima-1.8.4-cp38-cp38-macosx_10_15_x86_64.whl (595 kB)
...
Successfully installed pmdarima-1.8.4

另外,也可以用Python安装 3.9.x:

(tmp) tmp$ pip -V
pip 21.2.4 from /path/to/tmp/lib/python3.9/site-packages/pip (python 3.9)
(tmp) tmp$ python3.9 -V
Python 3.9.7
(tmp) tmp$ python3.9 -m pip install pmdarima
...
Collecting pmdarima
  Downloading pmdarima-1.8.4-cp39-cp39-macosx_10_15_x86_64.whl (603 kB)
...
Successfully installed Cython-0.29.24 joblib-1.1.0 pandas-1.3.4 patsy-0.5.2 pmdarima-1.8.4 python-dateutil-2.8.2 pytz-2021.3 scikit-learn-1.0.1 scipy-1.7.2 statsmodels-0.13.1 threadpoolctl-3.0.0 urllib3-1.26.7

如果您仍然遇到安装问题,请确保更新到最新的 pip (21.x) 和 Python 版本(3.8、3.9),并安装最新的 pmdarima (1.8.x).

2019 年原答案

您似乎在使用 Python 3.8:

c:\users\dobri\appdata\roaming\python\python38\site-packages

Python 3.8 于 2019 年 10 月刚刚发布,预计(或者这并不奇怪)并非所有第三方软件包都完全支持它。事实上,pmdarima 的 Github 存储库中有一个支持 Python 3.8 的未决问题。见 https://github.com/tgsmith61591/pmdarima/issues/199:

Python 3.8 was released on 2019-10-14. It appears to be fully backwards compatible, we just need to pre-build wheels for it. Currently, some of our dependencies do not support 3.8, so we will have to wait for them, but this issue is to track any conversation around 3.8 support

请注意有关等待其依赖项支持 3.8 的部分,然后才能构建合适的轮子。您可以关注该票证 and/or post 您的安装问题,以便通知他们(请务必提供 完整 环境详细信息!)。

您现在可以做的最好的事情是 降级到 Python 3.7 并使用它来安装 pmdarima。它在 Python 3.7.5.

上安装正常
$ python -V
Python 3.7.5
$ python -m pip install pmdarima
...
Successfully installed Cython-0.29.14 joblib-0.14.0 numpy-1.17.4 pandas-0.25.3 patsy-0.5.1 pmdarima-1.4.0 python-dateutil-2.8.1 pytz-2019.3 scikit-learn-0.21.3 scipy-1.3.2 statsmodels-0.10.1

一旦 pmdarima 支持,就将您的 project/app/script 迁移到 Python 3.8。