Skip to content

Segmentation and classification examples throw runtime errors #306

@gml16

Description

@gml16

Describe the bug
Running any of the segmentation or classification training examples (ignite or not and for both dict and array) throws a runtime error.

For instance, running this:
python examples\classification_3d_ignite\densenet_training_array.py

Will give the following output:

MONAI version: 0.1.0
Python version: 3.7.5rc1 (tags/v3.7.5rc1:4082f600a5, Oct  1 2019, 20:28:14) [MSC v.1916 64 bit (AMD64)]
Numpy version: 1.17.3
Pytorch version: 1.5.0+cu92
Ignite version: 0.3.0
MONAI version: 0.1.0
Python version: 3.7.5rc1 (tags/v3.7.5rc1:4082f600a5, Oct  1 2019, 20:28:14) [MSC v.1916 64 bit (AMD64)]
Numpy version: 1.17.3
Pytorch version: 1.5.0+cu92
Ignite version: 0.3.0
MONAI version: 0.1.0
Python version: 3.7.5rc1 (tags/v3.7.5rc1:4082f600a5, Oct  1 2019, 20:28:14) [MSC v.1916 64 bit (AMD64)]
Numpy version: 1.17.3
Pytorch version: 1.5.0+cu92
Ignite version: 0.3.0
Traceback (most recent call last):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 1, in <module>
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 105, in spawn_main
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)    exitcode = _main(fd)

  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 114, in _main
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 114, in _main
        prepare(preparation_data)
prepare(preparation_data)  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 225, in prepare

    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 225, in prepare
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
    _fixup_main_from_path(data['init_main_from_path'])    run_name="__mp_main__")

  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 263, in run_path
    run_name="__mp_main__")
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 96, in _run_module_code
    pkg_name=pkg_name, script_name=fname)
    mod_name, mod_spec, pkg_name, script_name)  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 96, in _run_module_code

  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
    mod_name, mod_spec, pkg_name, script_name)    exec(code, run_globals)

  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
  File "C:\Users\gmler\Git\MONAI\examples\classification_3d_ignite\densenet_training_array.py", line 75, in <module>
    exec(code, run_globals)    im, label = monai.utils.misc.first(check_loader)

  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\site-packages\monai\utils\misc.py", line 36, in first
  File "C:\Users\gmler\Git\MONAI\examples\classification_3d_ignite\densenet_training_array.py", line 75, in <module>
    for i in iterable:
im, label = monai.utils.misc.first(check_loader)  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 279, in __iter__

    return _MultiProcessingDataLoaderIter(self)
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 719, in __init__
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\site-packages\monai\utils\misc.py", line 36, in first
        w.start()
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\process.py", line 112, in start
for i in iterable:
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 279, in __iter__
        self._popen = self._Popen(self)
return _MultiProcessingDataLoaderIter(self)  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py", line 223, in _Popen

      File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 719, in __init__
return _default_context.get_context().Process._Popen(process_obj)
w.start()  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py", line 322, in _Popen

      File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\process.py", line 112, in start
return Popen(process_obj)
self._popen = self._Popen(self)  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\popen_spawn_win32.py", line 46, in __init__

      File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py", line 223, in _Popen
prep_data = spawn.get_preparation_data(process_obj._name)
return _default_context.get_context().Process._Popen(process_obj)  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 143, in get_preparation_data

      File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py", line 322, in _Popen
_check_not_importing_main()
return Popen(process_obj)  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main

      File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\popen_spawn_win32.py", line 46, in __init__
is not going to be frozen to produce an executable.''')
prep_data = spawn.get_preparation_data(process_obj._name)RuntimeError
:   File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 143, in get_preparation_data

        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.
_check_not_importing_main()
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
    is not going to be frozen to produce an executable.''')
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.
Traceback (most recent call last):
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 761, in _try_get_data
    data = self._data_queue.get(timeout=timeout)
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\queue.py", line 178, in get
    raise Empty
_queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".\classification_3d_ignite\densenet_training_array.py", line 75, in <module>
    im, label = monai.utils.misc.first(check_loader)
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\site-packages\monai\utils\misc.py", line 36, in first
    for i in iterable:
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 345, in __next__
    data = self._next_data()
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 841, in _next_data
    idx, data = self._get_data()
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 798, in _get_data
    success, data = self._try_get_data()
  File "C:\Users\gmler\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 774, in _try_get_data
    raise RuntimeError('DataLoader worker (pid(s) {}) exited unexpectedly'.format(pids_str))
RuntimeError: DataLoader worker (pid(s) 22320, 18572) exited unexpectedly

To Reproduce
Run python examples\classification_3d_ignite\densenet_training_array.py

Expected behavior
No runtime error.

Environment (please complete the following information):

  • OS: Windows 10
  • Python version: 3.7.5rc1
  • MONAI version: 0.1.0, git hash: af9f654
  • CUDA/cuDNN version: 10.2
  • GPU models and configuration: GeForce mx250, driver version 442.53

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions