rpy2 works in console, but cannot be imported by website ( with error “R_isMethodsDispatchOn”)

…衆ロ難τιáo~ 提交于 2019-12-25 14:22:50

问题


I developed a web tool using CGI, python and apache.
The CGI file was written by python, and it calls R functions through rpy2.
The web tool works well on my personal computer.
Then we are trying to set it up on the server (System: CentOS release 5.7).
Since the version of python and R were old on the server, we installed latest Python and R and also rpy2 on the server(Python version: 2.7.8, R version 3.1.1 (2014-07-10), rpy2 version: 2.4.3).

But the web tool meet problems when it tries to import the rpy2 package.
However, I can call the same R codes in console from python.
The reported error by website is shown below.

message = '' 
output = 'Error in .Call("R_isMethodsDispatchOn", onOff, P...aseenv.get("show")\nLookupError:  \'show\' not found\n' 
returncode = 1

Does anyone have any ideas about that?


回答1:


Usually this means a mix up of R versions between build time and run time.

Make sure the same R is in the PATH (web servers can ohave a restricted PATH by default).



来源:https://stackoverflow.com/questions/26051667/rpy2-works-in-console-but-cannot-be-imported-by-website-with-error-r-ismetho

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