I'm using the heroku-buildpack-r and heroku-buildpack-ruby in concert with heroku-buildpack-multi. Everything installs correctly and R works locally.
我正在使用heroku-buildpack-r和heroku-buildpack-ruby与heroku-buildpack-multi一起使用。一切安装正确,R在本地工作。
# .buildpacks
https://github.com/heroku/heroku-buildpack-ruby.git
https://github.com/virtualstaticvoid/heroku-buildpack-r.git
According to this heroku post, the environment is set for buildpacks by the YAML in bin/release:
根据这个heroku帖子,yAML在bin / release中为buildpack设置了环境:
cat <<EOF
---
config_vars:
PATH: /app/vendor/R/bin:bin:/usr/local/bin:/usr/bin:/bin
R_HOME: /app/vendor/R
R_INCLUDE: /app/vendor/R/lib64/R/include
EOF
This piece of code seems to run:
这段代码似乎运行:
R 2.15.1 successfully installed
Using release configuration from last framework R:
---
config_vars:
PATH: /app/vendor/R/bin:bin:/usr/local/bin:/usr/bin:/bin
R_HOME: /app/vendor/R
R_INCLUDE: /app/vendor/R/lib64/R/include
However, the path is not set to this following completion of the push:
但是,在完成推送后,路径未设置为此:
~ $ echo $PATH
/app/bin:/app/vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
I can set the PATH manually with heroku config:set
which seems to be the only solution.
我可以使用heroku config手动设置PATH:set似乎是唯一的解决方案。
Why doesn't the buildpack set the path as advertised?
为什么buildpack没有像宣传的那样设置路径?
3 个解决方案
#1
1
Using a .profile.d
script to set the environment variables seems to solve the problem when using with other buildpacks. You can use the fixes branch to try it out.
使用.profile.d脚本设置环境变量似乎解决了与其他buildpack一起使用时的问题。您可以使用fixes分支来试用它。
#2
0
Enable labs user-env-compile feature. This will make sure you have access to environment variables during compilation https://devcenter.heroku.com/articles/labs-user-env-compile#enabling
启用labs user-env-compile功能。这将确保您在编译期间可以访问环境变量https://devcenter.heroku.com/articles/labs-user-env-compile#enabling
#3
0
I hit a very similar issue when wiring together R and Python via Heroku. The trick is that the $PATH variable is reset for each buildpack as it is being run; the process is transactionalized per pack, and references a PATH that is not your heroku config:get PATH. I do not know why. You can make it work by forking the Heroku buildpack and explicitly adding on to the $PATH variable there. I hear you might be able to set up the "true" buildpack repo as an upstream of your change, making all future changes pass through, but I have only forked and mangled to get things going myself.
当通过Heroku将R和Python连接在一起时,我遇到了一个非常类似的问题。诀窍是每个buildpack在运行时重置$ PATH变量;该进程按包进行事务化,并引用不是您的heroku配置的PATH:获取PATH。我不知道为什么。您可以通过分叉Heroku buildpack并在那里显式添加到$ PATH变量来使其工作。我听说你可以设置“真正的”buildpack repo作为你改变的上游,让所有未来的改变都通过,但是我只是分叉并且破坏了我自己的事情。
Bonus round: you are probably going to hit problems even after this $PATH change as R complains about not being able to find things. You need to add some specific .so's to your LD_LIBRARY_PATH (this time, the actual heroku config var). Hope that helps!
奖金回合:即使在这个$ PATH改变之后你可能会遇到问题,因为R抱怨无法找到东西。您需要在LD_LIBRARY_PATH中添加一些特定的.so(这次是实际的heroku config var)。希望有所帮助!
#1
1
Using a .profile.d
script to set the environment variables seems to solve the problem when using with other buildpacks. You can use the fixes branch to try it out.
使用.profile.d脚本设置环境变量似乎解决了与其他buildpack一起使用时的问题。您可以使用fixes分支来试用它。
#2
0
Enable labs user-env-compile feature. This will make sure you have access to environment variables during compilation https://devcenter.heroku.com/articles/labs-user-env-compile#enabling
启用labs user-env-compile功能。这将确保您在编译期间可以访问环境变量https://devcenter.heroku.com/articles/labs-user-env-compile#enabling
#3
0
I hit a very similar issue when wiring together R and Python via Heroku. The trick is that the $PATH variable is reset for each buildpack as it is being run; the process is transactionalized per pack, and references a PATH that is not your heroku config:get PATH. I do not know why. You can make it work by forking the Heroku buildpack and explicitly adding on to the $PATH variable there. I hear you might be able to set up the "true" buildpack repo as an upstream of your change, making all future changes pass through, but I have only forked and mangled to get things going myself.
当通过Heroku将R和Python连接在一起时,我遇到了一个非常类似的问题。诀窍是每个buildpack在运行时重置$ PATH变量;该进程按包进行事务化,并引用不是您的heroku配置的PATH:获取PATH。我不知道为什么。您可以通过分叉Heroku buildpack并在那里显式添加到$ PATH变量来使其工作。我听说你可以设置“真正的”buildpack repo作为你改变的上游,让所有未来的改变都通过,但是我只是分叉并且破坏了我自己的事情。
Bonus round: you are probably going to hit problems even after this $PATH change as R complains about not being able to find things. You need to add some specific .so's to your LD_LIBRARY_PATH (this time, the actual heroku config var). Hope that helps!
奖金回合:即使在这个$ PATH改变之后你可能会遇到问题,因为R抱怨无法找到东西。您需要在LD_LIBRARY_PATH中添加一些特定的.so(这次是实际的heroku config var)。希望有所帮助!