flask+uwsgi+nginx+centos error import module numpy

十年热恋 提交于 2019-12-13 00:24:41

问题


python 3.6 in virtualenv with numpy

when i start the service:

r-python uwsgi[9729]: def empty_like(prototype, dtype=None, order=None, subok=None):
r-python uwsgi[9729]: File "/home/user01/python/conserva/conservaenv/lib64/python3.6/site-packages/numpy/core/overrides.py", line 240, in decorator
r-python uwsgi[9729]: docs_from_dispatcher=docs_from_dispatcher)(implementation)
r-python uwsgi[9729]: File "/home/user01/python/conserva/conservaenv/lib64/python3.6/site-packages/numpy/core/overrides.py", line 204, in decorator
r-python uwsgi[9729]: add_docstring(implementation, dispatcher.__doc__)
r-python uwsgi[9729]: RuntimeError: empty_like method already has a docstring
r-python uwsgi[9729]: VACUUM: unix socket conserva.sock removed.
r-python systemd[1]: conserva.service: main process exited, code=exited, status=22/n/a
r-python systemd[1]: Unit conserva.service entered failed state.
r-python systemd[1]: conserva.service failed.

if i remove the 'import numpy' from the app code, the service run. Which is the problem? how can i fix it?


回答1:


I've run into this while running projects under uWSGI that import numpy. There is some interaction between the default sub interpreters that uWSGIs uses and numpy's initialization.

You can tell uWSGI to not use sub interpreters in your config for uWSGI with the line:

single-interpreter = true

Where to add this will depend on how you configured uWSGI.



来源:https://stackoverflow.com/questions/54377070/flaskuwsginginxcentos-error-import-module-numpy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!