Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase. #26

Open
nachinGirid opened this issue Mar 25, 2024 · 1 comment

Comments

@nachinGirid
Copy link

I encountered an error while executing Simba through a bash job submission, as detailed below.

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/multiprocessing/spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/multiprocessing/spawn.py", line 125, in _main
    prepare(preparation_data)
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/multiprocessing/spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/runpy.py", line 289, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/runpy.py", line 96, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/data2/duren_lab/naqing/pipeline_building/Dimension_reduction/code/SIMBA/pbmc/pbmc.py", line 74, in <module>
    si.tl.pbg_train(auto_wd=True, save_wd=True, output='model')
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/site-packages/simba/tools/_pbg.py", line 939, in pbg_train
    train(train_config, subprocess_init=subprocess_init)
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/site-packages/torchbiggraph/train.py", line 54, in train
    coordinator = CoordinatorT(config, model, trainer, evaluator, rank, subprocess_init)
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/site-packages/torchbiggraph/train_cpu.py", line 418, in __init__
    self.pool = create_pool(
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/site-packages/torchbiggraph/util.py", line 308, in create_pool
    return mp.get_context("spawn").Pool(
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/multiprocessing/context.py", line 119, in Pool
    return Pool(processes, initializer, initargs, maxtasksperchild,
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/multiprocessing/pool.py", line 215, in __init__
    self._repopulate_pool()
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/multiprocessing/pool.py", line 306, in _repopulate_pool
    return self._repopulate_pool_static(self._ctx, self.Process,
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/multiprocessing/pool.py", line 329, in _repopulate_pool_static
    w.start()
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/multiprocessing/context.py", line 288, in _Popen
    return Popen(process_obj)
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/multiprocessing/popen_spawn_posix.py", line 42, in _launch
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/multiprocessing/spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "/data2/duren_lab/naqing/conda_envs/env_simba/lib/python3.10/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.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

And it seems like after this error, the script run all over again and is repeated couple of times
However, when running it interactively on the cluster, it operates without issues.
Could you suggest what might be causing this issue? Any assistance would be greatly appreciated.

@jesswhitts
Copy link

I'm having the same issue... Can run in jupyter notebook but not on the cluster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants