alkaline-ml / pmdarima

A statistical library designed to fill the void in Python's time series analysis capabilities, including the equivalent of R's auto.arima function.
https://www.alkaline-ml.com/pmdarima
MIT License
1.6k stars 234 forks source link

Can´t import pmdarima #560

Closed Kloferhit closed 1 year ago

Kloferhit commented 1 year ago

Describe the bug

Seems that i cant import pmdarima because of numpy. But my numpy is the last version.

i tried:

from pmdarima.utils import diff_inv

the error says:

ModuleNotFoundError Traceback (most recent call last) c:\Renato\script_atenea\atenea predict Final.ipynb Cell 1 line 1 12 from dateutil.relativedelta import relativedelta 13 from tqdm.notebook import tqdm ---> 14 from pmdarima.utils import diff_inv 15 from sklearn.ensemble import IsolationForest 16 from sklearn.preprocessing import StandardScaler ModuleNotFoundError: No module named 'pmdarima'

so then i tried "pip install pmdarima" on the terminal but it also gives me an error, the error is described above.

To Reproduce

pip install pmdarima

Versions

last versions of all libraries.

Expected Behavior

pmdarima succesfully installed

Actual Behavior

Collecting pmdarima Using cached pmdarima-2.0.3.tar.gz (630 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting joblib>=0.11 (from pmdarima) Obtaining dependency information for joblib>=0.11 from https://files.pythonhosted.org/packages/10/40/d551139c85db202f1f384ba8bcf96aca2f329440a844f924c8a0040b6d02/joblib-1.3.2-py3-none-any.whl.metadata Using cached joblib-1.3.2-py3-none-any.whl.metadata (5.4 kB) Collecting Cython!=0.29.18,!=0.29.31,>=0.29 (from pmdarima) Obtaining dependency information for Cython!=0.29.18,!=0.29.31,>=0.29 from https://files.pythonhosted.org/packages/f0/a7/42116e4be098b5ae75669b76ad62216e2f67c5a9b8f87d6aa2b99bc9f9d7/Cython-3.0.3-cp312-cp312-win_amd64.whl.metadata Using cached Cython-3.0.3-cp312-cp312-win_amd64.whl.metadata (3.2 kB) Requirement already satisfied: numpy>=1.21.2 in c:\users\renato\appdata\local\programs\python\python312\lib\site-packages (from pmdarima) (1.26.0) Collecting pandas>=0.19 (from pmdarima) Obtaining dependency information for pandas>=0.19 from https://files.pythonhosted.org/packages/89/c8/466196b756d74326820fe227743105fda0198a133f18916610e068540f0f/pandas-2.1.1-cp312-cp312-win_amd64.whl.metadata Using cached pandas-2.1.1-cp312-cp312-win_amd64.whl.metadata (18 kB) Collecting scikit-learn>=0.22 (from pmdarima) Obtaining dependency information for scikit-learn>=0.22 from https://files.pythonhosted.org/packages/37/a9/08538c29f188b1c37eb6e115a5046c6d17457e1a7b8ea748edd3017ddd6c/scikit_learn-1.3.1-cp312-cp312-win_amd64.whl.metadata Using cached scikit_learn-1.3.1-cp312-cp312-win_amd64.whl.metadata (11 kB) Collecting scipy>=1.3.2 (from pmdarima) Obtaining dependency information for scipy>=1.3.2 from https://files.pythonhosted.org/packages/f4/ce/be0b376ba6069f3f8ba240aa532a374733447453c93582d4c474effdde21/scipy-1.11.3-cp312-cp312-win_amd64.whl.metadata Using cached scipy-1.11.3-cp312-cp312-win_amd64.whl.metadata (60 kB) Collecting statsmodels>=0.13.2 (from pmdarima) Obtaining dependency information for statsmodels>=0.13.2 from https://files.pythonhosted.org/packages/a5/59/a4c19b49684ca2a469d7cd1a5682950e327c95c68e13aeea15533e576a8e/statsmodels-0.14.0-cp312-cp312-win_amd64.whl.metadata Using cached statsmodels-0.14.0-cp312-cp312-win_amd64.whl.metadata (9.3 kB) Collecting urllib3 (from pmdarima) Obtaining dependency information for urllib3 from https://files.pythonhosted.org/packages/26/40/9957270221b6d3e9a3b92fdfba80dd5c9661ff45a664b47edd5d00f707f5/urllib3-2.0.6-py3-none-any.whl.metadata Using cached urllib3-2.0.6-py3-none-any.whl.metadata (6.6 kB) Collecting setuptools!=50.0.0,>=38.6.0 (from pmdarima) Obtaining dependency information for setuptools!=50.0.0,>=38.6.0 from https://files.pythonhosted.org/packages/bb/26/7945080113158354380a12ce26873dd6c1ebd88d47f5bc24e2c5bb38c16a/setuptools-68.2.2-py3-none-any.whl.metadata Using cached setuptools-68.2.2-py3-none-any.whl.metadata (6.3 kB) Collecting python-dateutil>=2.8.2 (from pandas>=0.19->pmdarima) Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB) Collecting pytz>=2020.1 (from pandas>=0.19->pmdarima) Obtaining dependency information for pytz>=2020.1 from https://files.pythonhosted.org/packages/32/4d/aaf7eff5deb402fd9a24a1449a8119f00d74ae9c2efa79f8ef9994261fc2/pytz-2023.3.post1-py2.py3-none-any.whl.metadata Using cached pytz-2023.3.post1-py2.py3-none-any.whl.metadata (22 kB) Collecting tzdata>=2022.1 (from pandas>=0.19->pmdarima) Using cached tzdata-2023.3-py2.py3-none-any.whl (341 kB) Collecting threadpoolctl>=2.0.0 (from scikit-learn>=0.22->pmdarima) Obtaining dependency information for threadpoolctl>=2.0.0 from https://files.pythonhosted.org/packages/81/12/fd4dea011af9d69e1cad05c75f3f7202cdcbeac9b712eea58ca779a72865/threadpoolctl-3.2.0-py3-none-any.whl.metadata Using cached threadpoolctl-3.2.0-py3-none-any.whl.metadata (10.0 kB) Collecting patsy>=0.5.2 (from statsmodels>=0.13.2->pmdarima) Using cached patsy-0.5.3-py2.py3-none-any.whl (233 kB) Collecting packaging>=21.3 (from statsmodels>=0.13.2->pmdarima) Obtaining dependency information for packaging>=21.3 from https://files.pythonhosted.org/packages/ec/1a/610693ac4ee14fcdf2d9bf3c493370e4f2ef7ae2e19217d7a237ff42367d/packaging-23.2-py3-none-any.whl.metadata Using cached packaging-23.2-py3-none-any.whl.metadata (3.2 kB) Collecting six (from patsy>=0.5.2->statsmodels>=0.13.2->pmdarima) Using cached six-1.16.0-py2.py3-none-any.whl (11 kB) Using cached Cython-3.0.3-cp312-cp312-win_amd64.whl (2.8 MB) Using cached joblib-1.3.2-py3-none-any.whl (302 kB) Using cached pandas-2.1.1-cp312-cp312-win_amd64.whl (10.5 MB) Using cached scikit_learn-1.3.1-cp312-cp312-win_amd64.whl (9.1 MB) Using cached scipy-1.11.3-cp312-cp312-win_amd64.whl (43.7 MB) Using cached setuptools-68.2.2-py3-none-any.whl (807 kB) Using cached statsmodels-0.14.0-cp312-cp312-win_amd64.whl (9.1 MB) Using cached urllib3-2.0.6-py3-none-any.whl (123 kB) Using cached packaging-23.2-py3-none-any.whl (53 kB) Using cached pytz-2023.3.post1-py2.py3-none-any.whl (502 kB) Using cached threadpoolctl-3.2.0-py3-none-any.whl (15 kB) Building wheels for collected packages: pmdarima Building wheel for pmdarima (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for pmdarima (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [38 lines of output]

:15: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html Partial import of pmdarima during the build process. Traceback (most recent call last): File "", line 190, in check_package_status File "C:\Users\Renato\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1381, in _gcd_import File "", line 1354, in _find_and_load File "", line 1318, in _find_and_load_unlocked ModuleNotFoundError: No module named 'numpy' Requirements: ['joblib>=0.11\nCython>=0.29,!=0.29.18,!=0.29.31\nnumpy>=1.21.2\npandas>=0.19\nscikit-learn>=0.22\nscipy>=1.3.2\nstatsmodels>=0.13.2\nurllib3\nsetuptools>=38.6.0,!=50.0.0\n'] Adding extra setuptools args Traceback (most recent call last): File "C:\Users\Renato\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in main() File "C:\Users\Renato\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Renato\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel return _build_backend().build_wheel(wheel_directory, config_settings, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Renato\AppData\Local\Temp\pip-build-env-dlx9vxxf\overlay\Lib\site-packages\setuptools\build_meta.py", line 434, in build_wheel return self._build_with_temp_dir( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Renato\AppData\Local\Temp\pip-build-env-dlx9vxxf\overlay\Lib\site-packages\setuptools\build_meta.py", line 419, in _build_with_temp_dir self.run_setup() File "C:\Users\Renato\AppData\Local\Temp\pip-build-env-dlx9vxxf\overlay\Lib\site-packages\setuptools\build_meta.py", line 507, in run_setup super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script) File "C:\Users\Renato\AppData\Local\Temp\pip-build-env-dlx9vxxf\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup exec(code, locals()) File "", line 340, in File "", line 327, in do_setup File "", line 210, in check_package_status ImportError: numpy is not installed. pmdarima requires numpy >= 1.16. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pmdarima Failed to build pmdarima ERROR: Could not build wheels for pmdarima, which is required to install pyproject.toml-based projects ### Additional Context i´m not sure if the bug is with numpy, or with pmdarima or whit the version of python 3.12. seems that there is a library "distutils" that is necesary for that getting that wheels of the pmdarima. I´m not sure but i have tried a lot of things trying to install the pmdarima.
aaronreidsmith commented 1 year ago

Python 3.12 was released 7 days ago and is not currently supported by pmdarima. We'll have to do some work to get pre-built binaries out for 3.12. Right now pip is trying to build pmdarima from scratch, which is not recommended. You can use Python 3.11 for the time being.

aaronreidsmith commented 1 year ago

Python 3.12 support has been released:

$ python -c 'import pmdarima; pmdarima.show_versions()'

System:
    python: 3.12.0 (main, Oct 12 2023, 00:42:11) [GCC 12.2.0]
executable: /usr/local/bin/python
   machine: Linux-6.4.16-linuxkit-aarch64-with-glibc2.36

Python dependencies:
 setuptools: 68.2.2
        pip: 23.2.1
    sklearn: 1.3.2
statsmodels: 0.14.0
      numpy: 1.26.1
      scipy: 1.11.3
     Cython: 3.0.4
     pandas: 2.1.1
     joblib: 1.3.2
   pmdarima: 2.0.4