Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Installing statsmodel 0.13.2 (fixed dependency) fails on python 3.11. #38

Open
laqua-stack opened this issue May 2, 2024 · 1 comment

Comments

@laqua-stack
Copy link
Contributor

laqua-stack commented May 2, 2024

Trying to install statsmodels==0.13.2 fails on python 3.11.

This is likely related to statsmodels/statsmodels#8868.

Error log

```shell Collecting statsmodels==0.13.2 (from autorad==0.2.6) Downloading statsmodels-0.13.2.tar.gz (17.9 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.9/17.9 MB 67.7 MB/s eta 0:00:00 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
╰─> [151 lines of output]
:19: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
:218: 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
  
  
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
      # smooth
      for i in range(n):
          prev = (n+i-1) % n
  
          # s[t-m] = xhat[prev, 2+m-1]
          yhat[i] = (xhat[prev, 0] * xhat[prev, 1]**phi) + xhat[prev, 2+m-1]
                                                         ^
  ------------------------------------------------------------
  
  statsmodels/tsa/exponential_smoothing/_ets_smooth.pyx:156:55: Cannot assign type 'npy_float64 complex' to 'float64_t' (alias of 'double')
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  
          # s[t-m] = xhat[prev, 2+m-1]
          yhat[i] = (xhat[prev, 0] * xhat[prev, 1]**phi) + xhat[prev, 2+m-1]
          # l_t = a * (y_t - s_t-m) + (1-a) * (l_t-1 * b_t-1**phi)
          xhat[i, 0] = (alpha * (y[i] - xhat[prev, 2+m-1])
                        + (1 - alpha) * (xhat[prev, 0] * xhat[prev, 1]**phi))
                        ^
  ------------------------------------------------------------
  
  statsmodels/tsa/exponential_smoothing/_ets_smooth.pyx:159:22: Cannot assign type 'npy_float64 complex' to 'float64_t' (alias of 'double')
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          # l_t = a * (y_t - s_t-m) + (1-a) * (l_t-1 * b_t-1**phi)
          xhat[i, 0] = (alpha * (y[i] - xhat[prev, 2+m-1])
                        + (1 - alpha) * (xhat[prev, 0] * xhat[prev, 1]**phi))
          # b_t = (b*) * (l_t / l_t-1) + (1 - (b*)) * b_t-1**phi
          xhat[i, 1] = (beta_star * (xhat[i, 0] / xhat[prev, 0])
                        + (1 - beta_star) * xhat[prev, 1]**phi)
                        ^
  ------------------------------------------------------------
  
  statsmodels/tsa/exponential_smoothing/_ets_smooth.pyx:162:22: Cannot assign type 'npy_float64 complex' to 'float64_t' (alias of 'double')
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
      # smooth
      for i in range(n):
          prev = (n+i-1) % n
  
          # s[t-m] = xhat[prev, 2+m-1]
          yhat[i] = (xhat[prev, 0] * xhat[prev, 1]**phi) * xhat[prev, 2+m-1]
                                                         ^
  ------------------------------------------------------------
  
  statsmodels/tsa/exponential_smoothing/_ets_smooth.pyx:191:55: Cannot assign type 'npy_float64 complex' to 'float64_t' (alias of 'double')
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  
          # s[t-m] = xhat[prev, 2+m-1]
          yhat[i] = (xhat[prev, 0] * xhat[prev, 1]**phi) * xhat[prev, 2+m-1]
          # l_t = a * (y_t / s_t-m) + (1-a) * (l_t-1 * b_t-1**phi)
          xhat[i, 0] = (alpha * (y[i] / xhat[prev, 2+m-1])
                        + (1 - alpha) * (xhat[prev, 0] * xhat[prev, 1]**phi))
                        ^
  ------------------------------------------------------------
  
  statsmodels/tsa/exponential_smoothing/_ets_smooth.pyx:194:22: Cannot assign type 'npy_float64 complex' to 'float64_t' (alias of 'double')
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          # l_t = a * (y_t / s_t-m) + (1-a) * (l_t-1 * b_t-1**phi)
          xhat[i, 0] = (alpha * (y[i] / xhat[prev, 2+m-1])
                        + (1 - alpha) * (xhat[prev, 0] * xhat[prev, 1]**phi))
          # b_t = (b*) * (l_t / l_t-1) + (1 - (b*)) * b_t-1**phi
          xhat[i, 1] = (beta_star * (xhat[i, 0] / xhat[prev, 0])
                        + (1 - beta_star) * xhat[prev, 1]**phi)
                        ^
  ------------------------------------------------------------
  
  statsmodels/tsa/exponential_smoothing/_ets_smooth.pyx:197:22: Cannot assign type 'npy_float64 complex' to 'float64_t' (alias of 'double')
  Compiling statsmodels/tsa/_stl.pyx because it changed.
  Compiling statsmodels/tsa/holtwinters/_exponential_smoothers.pyx because it changed.
  Compiling statsmodels/tsa/exponential_smoothing/_ets_smooth.pyx because it changed.
  Compiling statsmodels/tsa/_innovations.pyx because it changed.
  Compiling statsmodels/tsa/regime_switching/_hamilton_filter.pyx because it changed.
  Compiling statsmodels/tsa/regime_switching/_kim_smoother.pyx because it changed.
  Compiling statsmodels/tsa/innovations/_arma_innovations.pyx because it changed.
  Compiling statsmodels/nonparametric/linbin.pyx because it changed.
  Compiling statsmodels/robust/_qn.pyx because it changed.
  Compiling statsmodels/nonparametric/_smoothers_lowess.pyx because it changed.
  Compiling statsmodels/tsa/statespace/_initialization.pyx because it changed.
  Compiling statsmodels/tsa/statespace/_representation.pyx because it changed.
  Compiling statsmodels/tsa/statespace/_kalman_filter.pyx because it changed.
  Compiling statsmodels/tsa/statespace/_filters/_conventional.pyx because it changed.
  Compiling statsmodels/tsa/statespace/_filters/_inversions.pyx because it changed.
  Compiling statsmodels/tsa/statespace/_filters/_univariate.pyx because it changed.
  Compiling statsmodels/tsa/statespace/_filters/_univariate_diffuse.pyx because it changed.
  Compiling statsmodels/tsa/statespace/_kalman_smoother.pyx because it changed.
  Compiling statsmodels/tsa/statespace/_smoothers/_alternative.pyx because it changed.
  Compiling statsmodels/tsa/statespace/_smoothers/_classical.pyx because it changed.
  Compiling statsmodels/tsa/statespace/_smoothers/_conventional.pyx because it changed.
  Compiling statsmodels/tsa/statespace/_smoothers/_univariate.pyx because it changed.
  Compiling statsmodels/tsa/statespace/_smoothers/_univariate_diffuse.pyx because it changed.
  Compiling statsmodels/tsa/statespace/_simulation_smoother.pyx because it changed.
  Compiling statsmodels/tsa/statespace/_cfa_simulation_smoother.pyx because it changed.
  Compiling statsmodels/tsa/statespace/_tools.pyx because it changed.
  [ 1/26] Cythonizing statsmodels/nonparametric/_smoothers_lowess.pyx
  [ 2/26] Cythonizing statsmodels/nonparametric/linbin.pyx
  [ 3/26] Cythonizing statsmodels/robust/_qn.pyx
  [ 4/26] Cythonizing statsmodels/tsa/_innovations.pyx
  [ 5/26] Cythonizing statsmodels/tsa/_stl.pyx
  [ 6/26] Cythonizing statsmodels/tsa/exponential_smoothing/_ets_smooth.pyx
  Traceback (most recent call last):
    File "/home/flaqua/.conda/envs/umm-nieren/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/home/flaqua/.conda/envs/umm-nieren/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/flaqua/.conda/envs/umm-nieren/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
             ^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-_wel6lhq/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-_wel6lhq/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-_wel6lhq/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 487, in run_setup
      super().run_setup(setup_script=setup_script)
    File "/tmp/pip-build-env-_wel6lhq/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 344, in <module>
    File "/tmp/pip-build-env-_wel6lhq/overlay/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize
      cythonize_one(*args)
    File "/tmp/pip-build-env-_wel6lhq/overlay/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_one
      raise CompileError(None, pyx_file)
  Cython.Compiler.Errors.CompileError: statsmodels/tsa/exponential_smoothing/_ets_smooth.pyx
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.



</p>
</details> 

/
@laqua-stack
Copy link
Contributor Author

Since statsmodels==0.13.4 there is support for Python 3.11.
0.13.5 has a minor bugfix - so I suggest to take statsmodels 0.13.5. 0.14 has major changes considering numpy 2 support - this may make thinks only worse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant