celery 'Worker-n' pid:xxxx exited with 'exitcode 1' when I import hmmlearn

前端 未结 2 1703
深忆病人
深忆病人 2021-01-13 14:26

In my tasks.py file, when I import hmmlearn,

from hmmlearn import hmm

and start my celery workers, I get the following error



        
相关标签:
2条回答
  • 2021-01-13 15:12

    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 imports from sklearn:

    from multiprocessing import current_process
    try:
        current_process()._config
    except AttributeError:
        current_process()._config = {'semprefix': '/mp'}
    
    0 讨论(0)
  • 2021-01-13 15:17

    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
    
    0 讨论(0)
提交回复
热议问题