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

Can't pickle local object 'Flask.init..' #115

Open
RalfKellner opened this issue Oct 20, 2021 · 3 comments
Open

Can't pickle local object 'Flask.init..' #115

RalfKellner opened this issue Oct 20, 2021 · 3 comments

Comments

@RalfKellner
Copy link

When running the code below, I get the error "Can't pickle local object 'Flask.init..'"

import sherpa
parameters = [sherpa.Discrete('num_units', [50, 200])]
alg = sherpa.algorithms.RandomSearch(max_num_trials=50)
study = sherpa.Study(parameters=parameters,
algorithm=alg,
lower_is_better=True)

Can you recommend me something which solves this error?

@LemonCANDY42
Copy link

me too..
Traceback (most recent call last):
File "/Users/kennymccormick/github/QInvestment/Monitor_RPC_Client.py", line 16, in
study = sherpa.Study(parameters=parameters,
File "/Users/kennymccormick/opt/miniconda3/envs/scientific/lib/python3.9/site-packages/sherpa/core.py", line 109, in init
self.dashboard_process = self._run_web_server(dashboard_port)
File "/Users/kennymccormick/opt/miniconda3/envs/scientific/lib/python3.9/site-packages/sherpa/core.py", line 300, in _run_web_server
proc.start()
File "/Users/kennymccormick/opt/miniconda3/envs/scientific/lib/python3.9/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
File "/Users/kennymccormick/opt/miniconda3/envs/scientific/lib/python3.9/multiprocessing/context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "/Users/kennymccormick/opt/miniconda3/envs/scientific/lib/python3.9/multiprocessing/context.py", line 284, in _Popen
return Popen(process_obj)
File "/Users/kennymccormick/opt/miniconda3/envs/scientific/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 32, in init
super().init(process_obj)
File "/Users/kennymccormick/opt/miniconda3/envs/scientific/lib/python3.9/multiprocessing/popen_fork.py", line 19, in init
self._launch(process_obj)
File "/Users/kennymccormick/opt/miniconda3/envs/scientific/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 47, in _launch
reduction.dump(process_obj, fp)
File "/Users/kennymccormick/opt/miniconda3/envs/scientific/lib/python3.9/multiprocessing/reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'Flask.init..'

@rrushing20
Copy link

I had the same issue, interestingly enough I fixed it by reverting back to python 3.6. Hopefully, this works for you.

@AharonSterman
Copy link

AharonSterman commented Sep 21, 2022

After 3 days, thanks g-d I found this
just add an import and a first line of code

from sherpa import multiprocessing

multiprocessing.set_start_method("fork")

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

4 participants