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

error:The "freeze_support()" line can be omitted if the program is not going to be frozen to produce an executable. #207

Open
yitai000 opened this issue Apr 1, 2024 · 0 comments

Comments

@yitai000
Copy link

yitai000 commented Apr 1, 2024

job exception:
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

Traceback (most recent call last):
File "", line 1, in
File "D:\app\anaconda3\envs\hyperopt\Lib\multiprocessing\spawn.py", line 122, in spawn_main
exitcode = _main(fd, parent_sentinel)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\app\anaconda3\envs\hyperopt\Lib\multiprocessing\spawn.py", line 131, in _main
prepare(preparation_data)
File "D:\app\anaconda3\envs\hyperopt\Lib\multiprocessing\spawn.py", line 246, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "D:\app\anaconda3\envs\hyperopt\Lib\multiprocessing\spawn.py", line 297, in _fixup_main_from_path
main_content = runpy.run_path(main_path,
^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 291, in run_path
File "", line 98, in _run_module_code
File "", line 88, in _run_code
File "D:\projects\pycharmProjects\EXP\XGB\XGB_classifier.py", line 39, in
estimator.fit(x_train, y_train)
File "D:\app\anaconda3\envs\hyperopt\Lib\site-packages\hpsklearn\estimator\estimator.py", line 480, in fit
fit_iter.send(increment)
File "D:\app\anaconda3\envs\hyperopt\Lib\site-packages\hpsklearn\estimator\estimator.py", line 347, in fit_iter
hyperopt.fmin(_fn_with_timeout,
File "D:\app\anaconda3\envs\hyperopt\Lib\site-packages\hyperopt\fmin.py", line 540, in fmin
return trials.fmin(
^^^^^^^^^^^^
File "D:\app\anaconda3\envs\hyperopt\Lib\site-packages\hyperopt\base.py", line 671, in fmin
return fmin(
^^^^^
File "D:\app\anaconda3\envs\hyperopt\Lib\site-packages\hyperopt\fmin.py", line 586, in fmin
rval.exhaust()
File "D:\app\anaconda3\envs\hyperopt\Lib\site-packages\hyperopt\fmin.py", line 364, in exhaust
self.run(self.max_evals - n_done, block_until_done=self.asynchronous)
File "D:\app\anaconda3\envs\hyperopt\Lib\site-packages\hyperopt\fmin.py", line 300, in run
self.serial_evaluate()
File "D:\app\anaconda3\envs\hyperopt\Lib\site-packages\hyperopt\fmin.py", line 178, in serial_evaluate
result = self.domain.evaluate(spec, ctrl)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\app\anaconda3\envs\hyperopt\Lib\site-packages\hyperopt\base.py", line 892, in evaluate
rval = self.fn(pyll_rval)
^^^^^^^^^^^^^^^^^^
File "D:\app\anaconda3\envs\hyperopt\Lib\site-packages\hpsklearn\estimator\estimator.py", line 304, in _fn_with_timeout
th.start()
File "D:\app\anaconda3\envs\hyperopt\Lib\multiprocessing\process.py", line 121, in start
self._popen = self._Popen(self)
^^^^^^^^^^^^^^^^^
File "D:\app\anaconda3\envs\hyperopt\Lib\multiprocessing\context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\app\anaconda3\envs\hyperopt\Lib\multiprocessing\context.py", line 336, in _Popen
return Popen(process_obj)
^^^^^^^^^^^^^^^^^^
File "D:\app\anaconda3\envs\hyperopt\Lib\multiprocessing\popen_spawn_win32.py", line 46, in init
prep_data = spawn.get_preparation_data(process_obj._name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\app\anaconda3\envs\hyperopt\Lib\multiprocessing\spawn.py", line 164, in get_preparation_data
_check_not_importing_main()
File "D:\app\anaconda3\envs\hyperopt\Lib\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
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

1 participant