Skip to content

Some issue due to multiprocessing #1

@samuelgarcia

Description

@samuelgarcia

Hi Jeremy.
I am using this new mountainsort4 for spikeinetrface new API.
But I have some issue link to multiprocessing/dask.
Is it something easy to fix ?

Traceback (most recent call last):
  File "/home/samuel/Documents/SpikeInterface/spikeinterface/spikeinterface/sorters/basesorter.py", line 203, in run_from_folder
    SorterClass._run_from_folder(output_folder, sorter_params, verbose)
  File "/home/samuel/Documents/SpikeInterface/spikeinterface/spikeinterface/sorters/mountainsort4/mountainsort4.py", line 117, in _run_from_folder
    old_api_sorting = mountainsort4.mountainsort4(
  File "/home/samuel/.virtualenvs/py38/lib/python3.8/site-packages/mountainsort4/mountainsort4.py", line 38, in mountainsort4
    MS4.sort()
  File "/home/samuel/.virtualenvs/py38/lib/python3.8/site-packages/mountainsort4/ms4alg.py", line 842, in sort
    dask.compute(*dask_list, num_workers=self._num_workers)
  File "/home/samuel/.virtualenvs/py38/lib/python3.8/site-packages/dask/base.py", line 565, in compute
    results = schedule(dsk, keys, **kwargs)
  File "/home/samuel/.virtualenvs/py38/lib/python3.8/site-packages/dask/multiprocessing.py", line 197, in get
    pool = context.Pool(num_workers, initializer=initialize_worker_process)
  File "/usr/lib/python3.8/multiprocessing/context.py", line 119, in Pool
    return Pool(processes, initializer, initargs, maxtasksperchild,
  File "/usr/lib/python3.8/multiprocessing/pool.py", line 212, in __init__
    self._repopulate_pool()
  File "/usr/lib/python3.8/multiprocessing/pool.py", line 303, in _repopulate_pool
    return self._repopulate_pool_static(self._ctx, self.Process,
  File "/usr/lib/python3.8/multiprocessing/pool.py", line 326, in _repopulate_pool_static
    w.start()
  File "/usr/lib/python3.8/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
  File "/usr/lib/python3.8/multiprocessing/context.py", line 284, in _Popen
    return Popen(process_obj)
  File "/usr/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/usr/lib/python3.8/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/usr/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 42, in _launch
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "/usr/lib/python3.8/multiprocessing/spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "/usr/lib/python3.8/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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions