This message was deleted.
# general
s
This message was deleted.
🙌 1
j
Hey. Thanks for using statsforecast. Can you provide a reproducible example of the error?
t
Let me try. I will say that it is intermittent. For exactly the same parameters it sometime works and sometimes errors.
m
I wanted to post that we really appreciate those comments. Thanks @Toni Borders.
t
Of course. I am interested in providing feedback to you for ongoing development!
So I am loading the AirPassengersDF as sample data
Copy code
from statsforecast.utils import AirPassengersDF as panel_df
I have 2 very simple functions to fit and predict separately
Copy code
def fit():
    season = 7
    model = StatsForecast(df=panel_df,
                         models=[AutoARIMA(),
                                 AutoETS(model=['Z', 'Z', 'Z'], season_length=season),
                                 SeasonalNaive(season_length=season)],
                         freq='D',
                         n_jobs=1,
                         verbose=True)
    model.fit(panel_df)
    #write_model_to_s3(model)
    return

def load():
    with open('/Users/tmb/PycharmProjects/data-science/UFE/output_files/model.pkl', 'rb') as f:
        storedmodel = pickle.load(f)
    return storedmodel

def predict(model):
    forecast = model.predict(h=15, level=[90,95])
    print("forecast")
    print(forecast.head(3))
    return forecast
Note that I have saved off a fit from a previous run and am loading that for the prediction. The main controlling function looks as follows:
Copy code
def main():
    plot(panel_df)
    #add_zeros()

    # Time the fit and print
    init = time()
    fit()
    end = time()
    print(f'Fit Seconds: {(end - init) }')

    # Time load&predict and print
    init = time()
    model= load()
    forecast_df = predict(model)
    end = time()
    print(f'Load and Predict Seconds: {(end - init) }')

    # Time forecast only and print
    init = time()
    #forecast_only_df = SF_forecast()
    end = time()
    print(f'Forecast Only Seconds: {(end - init) }')
Finally it might also be relevant that my virtual environment is managed by the Poetry package management .toml file
Copy code
[tool.poetry.dependencies]
python = "^3.9"
plotly = "^5.17.0"
statsmodels = "^0.14.0"
boto3 = "^1.28.62"
tabulate = "^0.9.0"
matplotlib = "^3.8.0"
requests = "^2.31.0"
seaborn = "^0.13.0"
pandas-datareader = "^0.10.0"
jupyterlab = "^4.0.7"
scikit-learn = "^1.3.1"
mglearn = "^0.2.0"
dash = "^2.14.0"
statsforecast = "^1.6.0"
darts = "^0.26.0"
pylab-sdk = "^1.5.0"
utilsforecast = "^0.0.12"


[build-system]
requires = ["poetry-core"]
Let me know if you need any further info!
j
Where does the error happen?
t
It doesn’t provide information about where it is failing
That is all the information I have
j
Do you know the version of numba that you currently have? Seems like an issue with numba and macos arm64
Also your env seems like a conda one and you're using poetry (which I guess pulls from PyPI) so that could be causing issues. Is it possible for you to install numba from conda-forge?
t
I am not sure about the numba version. I don’t recall specifically installing it. I have the current version of StatsForecast (1.6.0). Would it have been installed with StatsForecast?
I definitely didn’t install a conda env.
j
Yes, it's a requirement of statsforecast, but you may be able to install it beforehand
t
I can try to install numba from conda-forge however.
j
The path of the prefix in your error is miniconda3-arm64, so it's trying to use something from there
t
hmmm yeah I saw that as well.
Copy code
This is from the poetry lock file [[package]]
name = "numba"
version = "0.58.1"
description = "compiling Python code using LLVM"
optional = false
python-versions = ">=3.8"
files = [
    {file = "numba-0.58.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:07f2fa7e7144aa6f275f27260e73ce0d808d3c62b30cff8906ad1dec12d87bbe"},
    {file = "numba-0.58.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:7bf1ddd4f7b9c2306de0384bf3854cac3edd7b4d8dffae2ec1b925e4c436233f"},
    {file = "numba-0.58.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:bc2d904d0319d7a5857bd65062340bed627f5bfe9ae4a495aef342f072880d50"},
    {file = "numba-0.58.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:4e79b6cc0d2bf064a955934a2e02bf676bc7995ab2db929dbbc62e4c16551be6"},
    {file = "numba-0.58.1-cp310-cp310-win_amd64.whl", hash = "sha256:81fe5b51532478149b5081311b0fd4206959174e660c372b94ed5364cfb37c82"},
    {file = "numba-0.58.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:bcecd3fb9df36554b342140a4d77d938a549be635d64caf8bd9ef6c47a47f8aa"},
    {file = "numba-0.58.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a1eaa744f518bbd60e1f7ccddfb8002b3d06bd865b94a5d7eac25028efe0e0ff"},
    {file = "numba-0.58.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:bf68df9c307fb0aa81cacd33faccd6e419496fdc621e83f1efce35cdc5e79cac"},
    {file = "numba-0.58.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:55a01e1881120e86d54efdff1be08381886fe9f04fc3006af309c602a72bc44d"},
    {file = "numba-0.58.1-cp311-cp311-win_amd64.whl", hash = "sha256:811305d5dc40ae43c3ace5b192c670c358a89a4d2ae4f86d1665003798ea7a1a"},
    {file = "numba-0.58.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:ea5bfcf7d641d351c6a80e8e1826eb4a145d619870016eeaf20bbd71ef5caa22"},
    {file = "numba-0.58.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:e63d6aacaae1ba4ef3695f1c2122b30fa3d8ba039c8f517784668075856d79e2"},
    {file = "numba-0.58.1-cp38-cp38-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:6fe7a9d8e3bd996fbe5eac0683227ccef26cba98dae6e5cee2c1894d4b9f16c1"},
    {file = "numba-0.58.1-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:898af055b03f09d33a587e9425500e5be84fc90cd2f80b3fb71c6a4a17a7e354"},
    {file = "numba-0.58.1-cp38-cp38-win_amd64.whl", hash = "sha256:d3e2fe81fe9a59fcd99cc572002101119059d64d31eb6324995ee8b0f144a306"},
    {file = "numba-0.58.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5c765aef472a9406a97ea9782116335ad4f9ef5c9f93fc05fd44aab0db486954"},
    {file = "numba-0.58.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:9e9356e943617f5e35a74bf56ff6e7cc83e6b1865d5e13cee535d79bf2cae954"},
    {file = "numba-0.58.1-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:240e7a1ae80eb6b14061dc91263b99dc8d6af9ea45d310751b780888097c1aaa"},
    {file = "numba-0.58.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:45698b995914003f890ad839cfc909eeb9c74921849c712a05405d1a79c50f68"},
    {file = "numba-0.58.1-cp39-cp39-win_amd64.whl", hash = "sha256:bd3dda77955be03ff366eebbfdb39919ce7c2620d86c906203bed92124989032"},
    {file = "numba-0.58.1.tar.gz", hash = "sha256:487ded0633efccd9ca3a46364b40006dbdaca0f95e99b8b83e778d1195ebcbaa"},
]
j
Those are all wheels (from PyPI) but since they were installed in a conda env there's probably some weird interaction happening. I haven't used poetry much but is it possible for you to create a new environment where you install everything from PyPI?
t
I can try to do so but it is just dinner time where I am located and I need to get dinner for children. I can try to install the new env tonight and retry.
It is weird that the behaviour is intermittent.
I can give you an update tomorrow if that is ok
j
sure. hope it works out and feel free to let us know if you need further help
âś… 1
a
it is a freaking numba problem, I'm guessing you're using apple silicon? that library is so god damn buggy on it. just use google colabs or ec2 instance. By the way docker is no go, it just doesn't like arm
t
ahhhh. I am indeed on an Apple silicon (M2) I will shift ro ec2 for production. Thanks for the tip @Akmal Soliev!