orbit icon indicating copy to clipboard operation
orbit copied to clipboard

UnboundLocalError: local variable 'pool' referenced before assignment

Open muthumula19 opened this issue 3 years ago • 7 comments

lgt = LGT( response_col="Sales", date_col="Date", estimator='stan-mcmc', seasonality=12, seed=8888 ) lgt.fit(df)

When i using it in ipynb file i didn't get any error but when i am using in .py file i getting error as UnboundLocalError: local variable 'pool' referenced before assignment i try to change few things in _map_parallel function but it won't work can you help to achive mcmc

muthumula19 avatar Jan 25 '22 05:01 muthumula19

could you also provide python version and os you are using?

edwinnglabs avatar Jan 25 '22 06:01 edwinnglabs

i am using Python 3.8.12 and windows 10

muthumula19 avatar Jan 25 '22 08:01 muthumula19

I experienced the same issue on Windows 10, Python 3.9.6, orbit-ml 1.1.1dev0.

Placing the code inside a main() function and using if __name__ == '__main__': main() seemed to work.

brandoncbryant avatar Feb 05 '22 22:02 brandoncbryant

How did you format this code so that it would run and work? I am receiving the same error.

ghost avatar Feb 10 '22 19:02 ghost

I can't share the code because it's work related, but the format was:

import ...

def main():

    df = ...

    model = LGT(
        response_col=response_col,
        date_col=date_col,
        estimator='stan-mcmc',
        seasonality=52,
    )

    model.fit(df)

if __name__ == '__main__':
    main()

brandoncbryant avatar Feb 13 '22 01:02 brandoncbryant

How did you format this code so that it would run and work? I am receiving the same error.

are you using the version from dev or from pypi ?

edwinnglabs avatar Feb 13 '22 03:02 edwinnglabs

The problem happens in jupyter notebook and it's due to the varied behaviors of multiprocessing across different operating systems and python versions.

For solutions, please refer to this thread https://github.com/uber/orbit/issues/520#issuecomment-1077937181.

Also, execute the code via __main__ block might also dodge this issue.

wangzhishi avatar Apr 07 '22 00:04 wangzhishi