cleanvision icon indicating copy to clipboard operation
cleanvision copied to clipboard

RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase

Open csv610 opened this issue 1 year ago • 3 comments

File "/opt/homebrew/Cellar/[email protected]/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/[email protected]/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 avatar Oct 06 '23 19:10 csv610

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

sanjanag avatar Oct 06 '23 20:10 sanjanag

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()

sanjanag avatar Nov 10 '23 01:11 sanjanag

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

jwmueller avatar Nov 10 '23 01:11 jwmueller