Nixtla / statsforecast

Lightning ⚡️ fast forecasting with statistical and econometric models.
https://nixtlaverse.nixtla.io/statsforecast
Apache License 2.0
3.97k stars 282 forks source link

StatsForecast package fails due to new fugue release #508

Closed fjoanr closed 1 year ago

fjoanr commented 1 year ago

What happened + What you expected to happen

When installing the package from scratch, an error is raised when importing the base class from your library:

from statsforecast import StatsForecast

which results in

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 1
----> 1 from statsforecast import StatsForecast

File /python3.10/site-packages/statsforecast/__init__.py:3
      1 __version__ = "1.5.0"
      2 __all__ = ["StatsForecast"]
----> 3 from .core import StatsForecast
      4 from .distributed import fugue

File /python3.10/site-packages/statsforecast/core.py:24
     21 from tqdm.autonotebook import tqdm
     23 from triad import conditional_dispatcher
---> 24 import fugue.api as fa
     25 from fugue.execution.factory import try_get_context_execution_engine
     27 # %% ../nbs/core.ipynb 6

File /python3.10/site-packages/fugue/__init__.py:5
      2 from triad.collections import Schema
      3 from triad.collections.fs import FileSystem
----> 5 from fugue.api import out_transform, transform
      6 from fugue.bag.array_bag import ArrayBag
      7 from fugue.bag.bag import Bag, BagDisplay

File /python3.10/site-packages/fugue/api.py:34
      3 from .dataframe.api import (
      4     alter_columns,
      5     as_array,
   (...)
     21     select_columns,
     22 )
     23 from .dataset.api import (
     24     as_fugue_dataset,
     25     as_local,
   (...)
     32     show,
     33 )
---> 34 from .execution.api import (
     35     aggregate,
     36     anti_join,
     37     as_fugue_engine_df,
     38     assign,
     39     broadcast,
     40     clear_global_engine,
     41     cross_join,
     42     distinct,
     43     dropna,
     44     engine_context,
     45     fillna,
     46     filter,
     47     full_outer_join,
     48     get_context_engine,
     49     get_current_conf,
     50     get_current_parallelism,
...
   (...)
     15         ansi_sql: bool = False,
     16     ):

ModuleNotFoundError: No module named '_qpd_antlr'

I managed to fix the issue by doing the following after installing statsforecast:

pip install --upgrade triad==0.8.8
pip install --upgrade qpd==0.4.1

You might want to either check your repository to solve the issue, or tighten the dependencies to more strict versions.

Versions / Dependencies

latest version, Python 3.10

Reproduction script

Check in description - simple issue caused due to release of a dependency here

Issue Severity

Medium: It is a significant difficulty but I can work around it.

Cheergui commented 1 year ago

Same issue. However, installing the versions you mentionned above didn't work for me. I'm encountering the following error :

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-24-abedefbcf2f7>](https://localhost:8080/#) in <cell line: 1>()
----> 1 from statsforecast import StatsForecast

14 frames
[/usr/local/lib/python3.10/dist-packages/typing_extensions.py](https://localhost:8080/#) in _check_generic(cls, parameters, elen)
    107             if (num_tv_tuples > 0) and (alen >= elen - num_tv_tuples):
    108                 return
--> 109         raise TypeError(f"Too {'many' if alen > elen else 'few'} parameters for {cls};"
    110                         f" actual {alen}, expected {elen}")
    111 

TypeError: Too few parameters for <class 'triad.utils.pandas_like.PandasLikeUtils'>; actual 1, expected 2

Following.

pablorodriper commented 1 year ago

Thanks @fjoanr, updating with

pip install --upgrade triad==0.8.8
pip install --upgrade qpd==0.4.1

fixed the issue for me!

kvnkho commented 1 year ago

Hi @pablorodriper @Cheergui @fjoanr ,

TLDR: Installing the latest versions will work. I will close this, but feel free to re-open if you find anything.

Sorry about this. This was a Fugue issue.

We had a bad release of an underlying package in Fugue called qpd. We immediately yanked the release but I think pip would install the old one if you haf a cache. Anyway, we resolved these (within the next day, but I just saw this issue now). More details can be found here if you are interested.

If you simply do:

pip install -U statsforecast

It may not get the latest versions of dependencies if statsforecast is not upgraded. So you can install the two packages independently.

pip install -U triad qpd