pupil-labs / pupil

Open source eye tracking
https://pupil-labs.com
GNU Lesser General Public License v3.0
1.47k stars 675 forks source link

Multiprocess building is broken on windows #628

Closed florianbussmann closed 7 years ago

florianbussmann commented 7 years ago
world - [INFO] pupil_detectors.build: Building extention modules...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\dev\tools\Python\Python35\lib\multiprocessing\spawn.py", line 106, in spawn_main
    exitcode = _main(fd)
  File "C:\dev\tools\Python\Python35\lib\multiprocessing\spawn.py", line 115, in _main
    prepare(preparation_data)
  File "C:\dev\tools\Python\Python35\lib\multiprocessing\spawn.py", line 226, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\dev\tools\Python\Python35\lib\multiprocessing\spawn.py", line 278, in _fixup_main_from_path
    run_name="__mp_main__")
  File "C:\dev\tools\Python\Python35\lib\runpy.py", line 254, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\dev\tools\Python\Python35\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\dev\tools\Python\Python35\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\dev\source\eyetracking\dev\trunk\pupil\pupil_src\capture\pupil_detectors\setup.py", line 120, in <module>
    ext_modules=cythonize(extensions, quiet=True, nthreads=8)
  File "C:\dev\tools\Python\Python35\lib\site-packages\Cython\Build\Dependencies.py", line 911, in cythonize
    nthreads, initializer=_init_multiprocessing_helper)
  File "C:\dev\tools\Python\Python35\lib\multiprocessing\context.py", line 118, in Pool
    context=self.get_context())
  File "C:\dev\tools\Python\Python35\lib\multiprocessing\pool.py", line 168, in __init__
    self._repopulate_pool()
  File "C:\dev\tools\Python\Python35\lib\multiprocessing\pool.py", line 233, in _repopulate_pool
    w.start()
  File "C:\dev\tools\Python\Python35\lib\multiprocessing\process.py", line 105, in start
    self._popen = self._Popen(self)
  File "C:\dev\tools\Python\Python35\lib\multiprocessing\context.py", line 313, in _Popen
    return Popen(process_obj)
  File "C:\dev\tools\Python\Python35\lib\multiprocessing\popen_spawn_win32.py", line 34, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "C:\dev\tools\Python\Python35\lib\multiprocessing\spawn.py", line 144, in get_preparation_data
    _check_not_importing_main()
  File "C:\dev\tools\Python\Python35\lib\multiprocessing\spawn.py", line 137, 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.
mkassner commented 7 years ago

Hi could you give some more context?

Is this running from source, trying to make a bundle?

florianbussmann commented 7 years ago

This happens when attempting to run from source on Windows. Building the pupil_detectors and calibration_method will fail with the error shown above.

If I surround the setup-block inside the setup.py files with the following phrase it will compile again.

if __name__ == '__main__':
    setup(
        name="pupil_detectors",
        [...]
    )

Seems like this line has been removed for some reason https://github.com/pupil-labs/pupil/commit/cc44309852181b71d81e61d769adeea86370c14d#diff-2cb76461048ac7fb511f5d86b87f3e2d

mkassner commented 7 years ago

Thanks for catching that! Fixed just now.

crmchan commented 5 years ago

Dear @florianbussmann How do you fix out this issue?