sherpa-ai/sherpa

Simple.py fails under windows

iandanforth opened this issue · 2 comments

Simply.py fails in two ways.

  1. It is not wrapped properly in a main clause
def main():
     ...

if __name__ == '__main__':
    main()

This causes any new process to crash as the file parsing has not completed.

  1. You get the following error trying to run after correcting the above.
$ python simple.py                                                                                                         
INFO:sherpa.core:                                                                                                          
-------------------------------------------------------                                                                    
SHERPA Dashboard running on http://192.168.1.67:8999                                                                       
-------------------------------------------------------                                                                    
Traceback (most recent call last):                                                                                         
  File "simple.py", line 73, in <module>                                                                                   
    main()                                                                                                                 
  File "simple.py", line 40, in main                                                                                       
    dashboard_port=8999)                                                                                                   
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python36\lib\site-packages\sherpa\core.py", line 98, in __init__        
    self.dashboard_process = self._run_web_server(dashboard_port)                                                          
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python36\lib\site-packages\sherpa\core.py", line 299, in _run_web_server
                                                                                                                           
    proc.start()                                                                                                           
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python36\lib\multiprocessing\process.py", line 105, in start            
    self._popen = self._Popen(self)                                                                                        
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python36\lib\multiprocessing\context.py", line 223, in _Popen           
    return _default_context.get_context().Process._Popen(process_obj)                                                      
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python36\lib\multiprocessing\context.py", line 322, in _Popen           
    return Popen(process_obj)                                                                                              
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python36\lib\multiprocessing\popen_spawn_win32.py", line 65, in __init__
                                                                                                                           
    reduction.dump(process_obj, to_child)                                                                                  
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python36\lib\multiprocessing\reduction.py", line 60, in dump            
    ForkingPickler(file, protocol).dump(obj)                                                                               
TypeError: can't pickle _thread.lock objects                                                                               
                                                                                                                           
Ian@BIANCA-TOWER C:\Users\Ian\clones\sherpa\examples                                                                       
$ Traceback (most recent call last):                                                                                       
  File "<string>", line 1, in <module>                                                                                     
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python36\lib\multiprocessing\spawn.py", line 105, in spawn_main         
    exitcode = _main(fd)                                                                                                   
  File "C:\Users\Ian\AppData\Local\Programs\Python\Python36\lib\multiprocessing\spawn.py", line 115, in _main              
    self = reduction.pickle.load(from_parent)                                                                              
EOFError: Ran out of input

I am also facing this issue. Any workaround found?

I believe that at this point the best way might be to disable the dashboard by setting Study(...,disable_dashboard=True).