intive-DataScience / tbats

BATS and TBATS forecasting methods
MIT License
178 stars 19 forks source link

Multiprocessing Error in Windows #21

Closed koralturkk closed 4 years ago

koralturkk commented 4 years ago

bats and tbats forecast calls cause a multiprocessing error in Windows machines, which results in an unexpected looping of the code run. The same problem does not reproduce itself in Mac.

Traceback (most recent call last): File "", line 1, in File "C:\tmp\python\lib\multiprocessing\spawn.py", line 105, in spawn_main exitcode = _main(fd) File "C:\tmp\python\lib\multiprocessing\spawn.py", line 114, in _main prepare(preparation_data) File "C:\tmp\python\lib\multiprocessing\spawn.py", line 225, in prepare _fixup_main_from_path(data['init_main_from_path']) File "C:\tmp\python\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path run_name="__mp_main__") File "C:\tmp\python\lib\runpy.py", line 263, in run_path pkg_name=pkg_name, script_name=fname) File "C:\tmp\python\lib\runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "C:\tmp\python\lib\runpy.py", line 85, in _run_code exec(code, run_globals)

cotterpl commented 4 years ago

Have you used if __name__ == '__main__':?

koralturkk commented 4 years ago

No I haven't used it. I have found a solution in changing n_jobs parameter to 1 from None, to avoid any multiprocessing activity of the package. What is the reasoning behind if name == 'main': ?

cotterpl commented 4 years ago

Please see https://docs.python.org/2/library/multiprocessing.html#windows for explanation. I am closing this issue.