suny-downstate-medical-center / netpyne

A Python package to facilitate the development, parallel simulation, optimization and analysis of multiscale biological neuronal networks in NEURON.
http://www.netpyne.org
MIT License
146 stars 137 forks source link

[Bug report] asd_parallel and optuna not working on Windows for batch simulations #684

Closed josemendez-villanueva closed 1 year ago

josemendez-villanueva commented 2 years ago

Running netpyne/examples/asdOptima/batch.py and netpyne/examples/optunaOptim/batch.py generate the following error:

AttributeError: module 'os' has no attribute 'setsid'

Both files in netpyne/netpyne/batch/asd_parallel.py and netpyne/netpyne/batch/optuna_parallel.py have this attribute 'setsid' that is not usable in Windows.

jchen6727 commented 1 year ago

Pull Request #729

notes: os is different for Windows. os.setsid does not exist in Windows. preexec_fn=os.setsid now implemented by setting start_new_session=True from the subprocess documentation

Note If you need to modify the environment for the child use the env parameter rather than doing it in a preexec_fn. The start_new_session and process_group parameters should take the place of code using preexec_fn to call os.setsid() or os.setpgid() in the child.

/bin/bash is not OS agnostic, and executer now specifies sh which should be a predefined alias if bash is supported

This should help windows users though WSL now available and may be preferred implementation.

jchen6727 commented 1 year ago

So far, the new PR has been working. Will close for now and can reopen if issue reappears.