Flask应用程序中的Rpy2:致命错误:无法初始化JIT [英] Rpy2 in a Flask App: Fatal error: unable to initialize the JIT
问题描述
我有一个Flask应用程序,并且我试图添加一个RESTful终结点,该终结点使用rpy2从 .rds
文件加载模型.当我使用包含 import rpy2.robjects as objects
的 python3 testscript.py
运行测试脚本时,它可以正常工作.但是,当我在flask应用程序中的文件中尝试相同的导入,并使用 FLASK_ENV = development flask run
运行它时,出现以下错误:
I have a Flask app, and I'm trying to add a RESTful endpoint that uses rpy2 to load a model from a .rds
file. When I run my test script with python3 testscript.py
that contains import rpy2.robjects as objects
, it works fine. However when I try the same import in a file on my flask app, and run it using FLASK_ENV=development flask run
, I get the following error:
致命错误:无法初始化JIT
我认为这与Flask配置有关,并且找到了R,有人以前见过吗?
I assume this has something to do with the Flask configuration and finding R, has anyone seen this before?
推荐答案
原始帖子正确.该修补程序似乎是一种外部修补程序,例如设置一个不使用多线程的独立服务-例如,使用Redis服务器.
The original post is correct. The fix would seem to be an external one, like setting up an independent service that doesn't multithread -- using a Redis server, for instance.
这是我的输出,带有rpy2 3.3.5 python 3.6.8破折号1.15.0烧瓶1.1.2
Here's my output, with rpy2 3.3.5 python 3.6.8 dash 1.15.0 flask 1.1.2
[Fri Aug 28 01:51:41.665103 2020] [wsgi:error] [pid 4707] [client 10.93.203.56:53374] Truncated or oversized response headers received from daemon process 'flask_app': /var/www/html/flask_app.wsgi
[Fri Aug 28 01:58:08.393491 2020] [mpm_prefork:notice] [pid 4702] AH00170: caught SIGWINCH, shutting down gracefully
[Fri Aug 28 01:58:09.523054 2020] [core:notice] [pid 4754] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Fri Aug 28 01:58:09.523784 2020] [suexec:notice] [pid 4754] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Fri Aug 28 01:58:09.534708 2020] [so:warn] [pid 4754] AH01574: module rewrite_module is already loaded, skipping
[Fri Aug 28 01:58:09.537129 2020] [lbmethod_heartbeat:notice] [pid 4754] AH02282: No slotmem from mod_heartmonitor
[Fri Aug 28 01:58:09.539013 2020] [mpm_prefork:notice] [pid 4754] AH00163: Apache/2.4.6 (CentOS) mod_wsgi/4.6.5 Python/3.6 configured -- resuming normal operations
[Fri Aug 28 01:58:09.539036 2020] [core:notice] [pid 4754] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
Error: C stack usage 1087224955812 is too close to the limit
Error: C stack usage 1087224955860 is too close to the limit
Error: C stack usage 1087224955332 is too close to the limit
Fatal error: unable to initialize the JIT
已经将代码推送到一个子进程中,该子进程已导入,然后按照以下建议在包装器中调用:
Have already pushed the code to a subprocess which is imported and then called within a wrapper as suggested here: https://rpy2.github.io/doc/v3.3.x/html/rinterface.html#multithreading
from rpy2.rinterface_lib import openrlib
....
with openrlib.rlock:
import farrington2
d=farrington2.main()
pass
这篇关于Flask应用程序中的Rpy2:致命错误:无法初始化JIT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!