Closed mrv-king closed 3 years ago
You are using PyStan 2.x and on Windows you need to use if __name__ == '__main__':
block for your code.
@mrv-king This issue tracker is for bugs affecting PyStan 3. PyStan 2 is no longer supported.
Thanks, it works. 15:22, 21 августа 2021 г., Ari Hartikainen @.***>: You are using PyStan 2.x and on Windows you need to use if name == 'main': block for your code.
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android. -- Отправлено из мобильного приложения Яндекс.Почты
During handling of the above exception, another exception occurred:
Describe the bug
(base) PS C:\Users\nikgal-local> python Python 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information. (base) PS C:\Users\nikgal-local\Desktop\Applied_Bayesian_Data_Analysis\Python_APL\eight_schools> python eight_schools.py INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_67cb7d0f2cb7720776cbeb52007d2dbb NOW. INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_67cb7d0f2cb7720776cbeb52007d2dbb NOW. INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_67cb7d0f2cb7720776cbeb52007d2dbb NOW. INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_67cb7d0f2cb7720776cbeb52007d2dbb NOW. INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_67cb7d0f2cb7720776cbeb52007d2dbb NOW. INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_67cb7d0f2cb7720776cbeb52007d2dbb NOW. INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_67cb7d0f2cb7720776cbeb52007d2dbb NOW. INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_67cb7d0f2cb7720776cbeb52007d2dbb NOW. INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_67cb7d0f2cb7720776cbeb52007d2dbb NOW. Traceback (most recent call last): File "C:\Users\nikgal-local\anaconda3\lib\site-packages\pystan\model.py", line 84, in _map_parallel pool = multiprocessing.Pool(processes=n_jobs) File "C:\Users\nikgal-local\anaconda3\lib\multiprocessing\context.py", line 119, in Pool return Pool(processes, initializer, initargs, maxtasksperchild, File "C:\Users\nikgal-local\anaconda3\lib\multiprocessing\pool.py", line 212, in init self._repopulate_pool() File "C:\Users\nikgal-local\anaconda3\lib\multiprocessing\pool.py", line 303, in _repopulate_pool return self._repopulate_pool_static(self._ctx, self.Process, File "C:\Users\nikgal-local\anaconda3\lib\multiprocessing\pool.py", line 326, in _repopulate_pool_static w.start() File "C:\Users\nikgal-local\anaconda3\lib\multiprocessing\process.py", line 121, in start self._popen = self._Popen(self) File "C:\Users\nikgal-local\anaconda3\lib\multiprocessing\context.py", line 327, in _Popen return Popen(process_obj) File "C:\Users\nikgal-local\anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 45, in init prep_data = spawn.get_preparation_data(process_obj._name) File "C:\Users\nikgal-local\anaconda3\lib\multiprocessing\spawn.py", line 154, in get_preparation_data _check_not_importing_main() File "C:\Users\nikgal-local\anaconda3\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main raise RuntimeError(''' RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase.
Describe your system
Windows 10, 64-bit, Python 3.8.8. pystan was installed through the Anaconda.
Steps/Code to Reproduce
It happens, when i am trying to implement standard "eight_schools" example. The error occurs on line: "fit = sm.sampling(data=schools_data, iter=1000, chains=4)"
But, an example bellow, works without any issues: