In my tasks.py file, when I import hmmlearn,
from hmmlearn import hmm
and start my celery workers, I get the following error
I just stumbled upon a similar situation. Upgrading billiard
to 3.5, as suggested in a different answer, was not an option (because it conflicts with Celery==3.1.25
and I prefer that particular version for Windows its support).
I figured out, however, that in my case the problem was most probably due to this issue - it occurred only when I tried to import anything from sklearn
in the Worker's process.
The problem was resolved by adding this snippet before the import
s from sklearn
:
from multiprocessing import current_process
try:
current_process()._config
except AttributeError:
current_process()._config = {'semprefix': '/mp'}
This might be because celery 3.1.xx comes bundled with billiard 3.3.
If you upgrade that package (to 3.5 at time of writing), the service might work again.
pip install --upgrade billiard