错误:试图猜测R的HOME,但PATH中没有命令“ R”

时间:2019-05-23 06:57:49

标签: python heroku rpy2

我已经看到很多关于此错误的问题,但是似乎没有建议的解决方案对我有用。我在Heroku上部署了python应用程序,但在推送它时遇到此错误。我在用 https://github.com/virtualstaticvoid/heroku-buildpack-r.git#heroku-16 和heroku / python作为我的应用程序的两个buildpack。我在python 3.6.8上并安装rpy2 2.9.5

在部署时,heroku首先安装R(成功地,在存储库中有一个init.R文件),然后将该应用检测为Python应用,然后开始安装依赖项(在require.txt文件中),并在出现错误时给出错误进入rpy2==2.9.5

我看到了this answer,但不知道如何在Heroku上尝试。

这是来自部署尝试的完整日志

-----> R Console app detected
-----> Vendoring R 3.4.4 for heroku-16 stack (latest)
       Retrieving R binaries from cache
-----> Executing R init script
       Installing package into ‘/usr/local/lib/R/site-library’
       (as ‘lib’ is unspecified)
       trying URL 'https://cloud.r-project.org/src/contrib/blockTools_0.6-3.tar.gz'
       Content type 'application/x-gzip' length 51373 bytes (50 KB)
       ==================================================
       downloaded 50 KB

       * installing *source* package ‘blockTools’ ...
       ** package ‘blockTools’ successfully unpacked and MD5 sums checked
       ** libs
       gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c getDist.c -o getDist.o
       gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c naive.c -o naive.o
       gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c optgreed.c -o optgreed.o
       gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c util.c -o util.o
       g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o blockTools.so getDist.o naive.o optgreed.o util.o -L/usr/lib/R/lib -lR
       installing to /usr/local/lib/R/site-library/blockTools/libs
       ** R
       ** data
       ** demo
       ** inst
       ** preparing package for lazy loading
       ** help
       *** installing help indices
       ** building package indices
       ** testing if installed package can be loaded
       * DONE (blockTools)

       The downloaded source packages are in
        ‘/tmp/RtmpKojUrP/downloaded_packages’
       Loading required package: blockTools
       Unit 1 data stored as file sdata.RData.
       The current working directory is /
       Unit 1 assigned to Treatment 2.
       The new data as entered:
                  ID [API INPUT] age          Tr
       1 [API INPUT] [API INPUT]  25 Treatment 2
       R 3.4.4 successfully installed (with init)
-----> Caching build outputs
       Build took 50 seconds to complete
-----> Python app detected
-----> Installing python-3.6.8
-----> Installing pip
-----> Installing SQLite3
-----> Installing requirements with pip
       Collecting falcon==1.4.1 (from -r /tmp/build_888a086087211b8118b0e152044beded/requirements.txt (line 1))
         Downloading https://files.pythonhosted.org/packages/e8/d0/20bb807dee65f1f163754670557b128eafce1710f6c9c363a38e357f3783/falcon-1.4.1-py2.py3-none-any.whl (159kB)
       Collecting gunicorn==19.8.1 (from -r /tmp/build_888a086087211b8118b0e152044beded/requirements.txt (line 2))
         Downloading https://files.pythonhosted.org/packages/55/cb/09fe80bddf30be86abfc06ccb1154f97d6c64bb87111de066a5fc9ccb937/gunicorn-19.8.1-py2.py3-none-any.whl (112kB)
       Collecting Jinja2==2.10 (from -r /tmp/build_888a086087211b8118b0e152044beded/requirements.txt (line 3))
         Downloading https://files.pythonhosted.org/packages/7f/ff/ae64bacdfc95f27a016a7bed8e8686763ba4d277a78ca76f32659220a731/Jinja2-2.10-py2.py3-none-any.whl (126kB)
       Collecting MarkupSafe==1.0 (from -r /tmp/build_888a086087211b8118b0e152044beded/requirements.txt (line 4))
         Downloading https://files.pythonhosted.org/packages/4d/de/32d741db316d8fdb7680822dd37001ef7a448255de9699ab4bfcbdf4172b/MarkupSafe-1.0.tar.gz
       Collecting python-mimeparse==1.6.0 (from -r /tmp/build_888a086087211b8118b0e152044beded/requirements.txt (line 5))
         Downloading https://files.pythonhosted.org/packages/26/2e/03bce213a9bf02a2750dcb04e761785e9c763fc11071edc4b447eacbb842/python_mimeparse-1.6.0-py2.py3-none-any.whl
       Collecting rpy2==2.9.5 (from -r /tmp/build_888a086087211b8118b0e152044beded/requirements.txt (line 6))
         Downloading https://files.pythonhosted.org/packages/02/d1/074ffbbe7b4bf74c60b75d74c8e67a1e4515b0d85f85cd6540e39610754a/rpy2-2.9.5.tar.gz (194kB)
           Complete output from command python setup.py egg_info:
           Error: Tried to guess R's HOME but no command 'R' in the PATH.

           ----------------------------------------
       Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-d2_abgxe/rpy2/
 !     Push rejected, failed to compile Python app.
 !     Push failed

0 个答案:

没有答案