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

freeze_support() RuntimeError on Mac OS #52

Open
pisonir opened this issue Jul 9, 2020 · 3 comments
Open

freeze_support() RuntimeError on Mac OS #52

pisonir opened this issue Jul 9, 2020 · 3 comments

Comments

@pisonir
Copy link

pisonir commented Jul 9, 2020

Hi,

I'm trying to simply import pypeln

import pypeln as pl

on Mac OS Catalina 10.15.5, Python 3.8, pypeln 0.4.3 and I get the following error:

Traceback (most recent call last):
  File "/Users/.../python3.8/multiprocessing/spawn.py", line 125, in _main
    prepare(preparation_data)
  File "/Users/.../python3.8/multiprocessing/spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "/Users/.../python3.8/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "/Users/.../python3.8/runpy.py", line 265, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/Users/.../python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/Users/.../python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/.../main.py", line 1, in <module>
    import pypeln as pl
  File "/Users/pisonir/anaconda3/envs/.../python3.8/site-packages/pypeln/__init__.py", line 4, in <module>
    from . import thread
  File "/Users/pisonir/anaconda3/envs/.../lib/python3.8/site-packages/pypeln/thread/__init__.py", line 34, in <module>
    from .api.concat import concat
  File "/Users/pisonir/anaconda3/envs/.../lib/python3.8/site-packages/pypeln/thread/api/concat.py", line 8, in <module>
    from .to_stage import to_stage
  File "/Users/pisonir/anaconda3/envs/.../lib/python3.8/site-packages/pypeln/thread/api/to_stage.py", line 5, in <module>
    from ..stage import Stage
  File "/Users/pisonir/anaconda3/envs/.../lib/python3.8/site-packages/pypeln/thread/stage.py", line 7, in <module>
    from . import utils
  File "/Users/pisonir/anaconda3/envs/.../lib/python3.8/site-packages/pypeln/thread/utils.py", line 11, in <module>
    MANAGER = multiprocessing.Manager()
  File "/Users/pisonir/anaconda3/envs/.../lib/python3.8/multiprocessing/context.py", line 57, in Manager
    m.start()
  File "/Users/pisonir/anaconda3/envs/.../lib/python3.8/multiprocessing/managers.py", line 579, in start
    self._process.start()
  File "/Users/pisonir/anaconda3/envs/.../lib/python3.8/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
  File "/Users/pisonir/anaconda3/envs/.../lib/python3.8/multiprocessing/context.py", line 283, in _Popen
    return Popen(process_obj)
  File "/Users/pisonir/anaconda3/envs/.../lib/python3.8/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/Users/pisonir/anaconda3/envs/.../lib/python3.8/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/Users/pisonir/anaconda3/envs/.../lib/python3.8/multiprocessing/popen_spawn_posix.py", line 42, in _launch
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "/Users/pisonir/anaconda3/envs/.../lib/python3.8/multiprocessing/spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "/Users/pisonir/anaconda3/envs/.../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.

Any help or suggestion?

I saw a previous issue but mine it's performed on Mac OS.

Thank you!

@cgarciae
Copy link
Owner

cgarciae commented Jul 9, 2020

Hey, thanks for reporting. I'll push the fix from the other issue just in case. BTW, how are you running this line? (script, python shell, pycharm / vscode interpreter)

@pisonir
Copy link
Author

pisonir commented Jul 9, 2020

I run it on pycharm.
If I run it on jupyter notebook it actually works.

@cgarciae
Copy link
Owner

cgarciae commented Jul 9, 2020

Yeah, I think I should add a warning about PyCharm somewhere, this has happened before: #39 .
It seems PyCharm creates its own processes and has conflicts with pypeln, I will still push the change that might alleviate this (although I fear it will popup later in another form).

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