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 #230

Open
csv610 opened this issue Oct 6, 2023 · 3 comments
Labels
question Further information is requested

Comments

@csv610
Copy link

csv610 commented Oct 6, 2023

File "/opt/homebrew/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/spawn.py", line 164, in get_preparation_data
_check_not_importing_main()

File "/opt/homebrew/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/spawn.py", line 140, 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.

    To fix this issue, refer to the "Safe importing of main module"
    section in https://docs.python.org/3/library/multiprocessing.html
@csv610 csv610 added the question Further information is requested label Oct 6, 2023
@sanjanag
Copy link
Member

sanjanag commented Oct 6, 2023

Hi @csv610 ! Could you give more context? What were you trying to run and stacktrace related to cleanvision code?

@sanjanag
Copy link
Member

Hi @csv610 ! This might be caused by the multiprocessing library.
Could you try executing the code inside of a main block like this

if __name__ == "__main__":
    imagelab = Imagelab(data_path)
    imagelab.find_issues()

@jwmueller
Copy link
Member

FYI you can also try: imagelab.find_issues(..., n_jobs = 1) to disable multiprocessing entirely.

@jwmueller jwmueller changed the title What are these errors and warning? RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase Nov 10, 2023
@jwmueller jwmueller pinned this issue Nov 10, 2023
@sanjanag sanjanag unpinned this issue Nov 13, 2023
@jwmueller jwmueller pinned this issue Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants