Giter Club home page Giter Club logo

Comments (39)

virtualstaticvoid avatar virtualstaticvoid commented on May 24, 2024

I'll enhance the build and compile script to take the stack into account, as per instructions in Buildpack API - Stacks.

I should have this ready over the coming weekend.

from heroku-buildpack-r.

andrewmatthewthompson avatar andrewmatthewthompson commented on May 24, 2024

Thanks @virtualstaticvoid, I very much appreciate the effort.

from heroku-buildpack-r.

virtualstaticvoid avatar virtualstaticvoid commented on May 24, 2024

Sorry, this is taking longer than expected. I can't get R to build on cedar-14. It seems that the gfortran compiler isn't installed or configured properly. I'll keep trying and let you know on the progress.

Extract from the build log:

checking for kpdf... no
checking for open... no
checking for gpdf... no
checking for kghostview... no
configure: WARNING: I could not determine a PDF viewer
checking for notangle... false
checking for pkg-config... /usr/bin/pkg-config
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking whether gcc needs -traditional... no
checking how to run the C preprocessor... gcc -E
checking for gfortran... no
checking for f95... no
checking for fort... no
checking for xlf95... no
checking for ifort... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for gfortran... no
checking for ftn... no
checking for g95... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for pghpf... no
checking for epcf90... no
checking for g77... no
checking for f77... no
checking for xlf... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for fc... no
configure: error: No F77 compiler found

from heroku-buildpack-r.

greggers avatar greggers commented on May 24, 2024

I'm having the same issues, thanks for the updates.

from heroku-buildpack-r.

andrewmatthewthompson avatar andrewmatthewthompson commented on May 24, 2024

@virtualstaticvoid thanks for continuing to get this resolved.

from heroku-buildpack-r.

virtualstaticvoid avatar virtualstaticvoid commented on May 24, 2024

Still hammering away at this... Having to refactor the build script as there are a number of dependencies which weren't on cedar which are now included in cedar-14, including the dev packages in some cases.
See Ubuntu packages on Cedar and Cedar-14.

from heroku-buildpack-r.

andrewmatthewthompson avatar andrewmatthewthompson commented on May 24, 2024

Thanks for the update @virtualstaticvoid. I did notice that cedar-14 now comes with a bunch of packages by default that cedar didn't.

from heroku-buildpack-r.

andrewmatthewthompson avatar andrewmatthewthompson commented on May 24, 2024

@virtualstaticvoid Any luck with this issue?

from heroku-buildpack-r.

virtualstaticvoid avatar virtualstaticvoid commented on May 24, 2024

Unfortunately I haven't made any real progress getting the compile to work. I've pushed some of the changes necessary to the cedar-14 branch, and updated the S3 bucket so that the stack is included in the path to the binaries.

I'm trying out a new idea, using heroku-buildpack-apt, which lets you install packages using apt-get. It doesn't work for R though, as it explicitly references /usr/lib64, so I still need to compile R, and only some of it's dependencies which aren't included in cedar-14.

from heroku-buildpack-r.

greggers avatar greggers commented on May 24, 2024

Thanks for taking the time for working on this. For time being, I have rolled back to cedar.

from heroku-buildpack-r.

andrewmatthewthompson avatar andrewmatthewthompson commented on May 24, 2024

Thanks for the update @virtualstaticvoid. Sorry to hear its causing such problems. Hopefully this new heroku-buildpack-apt approach will work.

from heroku-buildpack-r.

virtualstaticvoid avatar virtualstaticvoid commented on May 24, 2024

Woot woot, I managed to get it working. The cedar-14 branch is updated and the new binaries placed on S3.

You can use https://github.com/virtualstaticvoid/heroku-buildpack-r.git#cedar-14 for the buildpack Url when creating Heroku apps to test. Once this is stable, I'll update the master branch to make it the default.

heroku create --stack cedar-14 --buildpack https://github.com/virtualstaticvoid/heroku-buildpack-r.git#cedar-14

from heroku-buildpack-r.

greggers avatar greggers commented on May 24, 2024

Awesome! Thanks for all your hard work.

from heroku-buildpack-r.

andrewmatthewthompson avatar andrewmatthewthompson commented on May 24, 2024

Nice one @virtualstaticvoid!

from heroku-buildpack-r.

andrewmatthewthompson avatar andrewmatthewthompson commented on May 24, 2024

Hi,

I'm trying to use this to upgrade to cedar-14 and I'm getting the following error: "/app/vendor/R/lib64/R/bin/exec/R: error while loading shared libraries: libreadline.so.5: cannot open shared object file: No such file or directory"

I contacted Heroku support and they told me the following: "I made some modifications to your application — everything worked great with the Python buildpack, however it appears as though the R buildpack that you are using simply isn't compatible with cedar-14 at this time. I would recommend getting in touch with the creators of that buildpack and reporting this issue."

Any ideas what the issue is here preventing R from being installed successfully on a cedar-14 stack?

Regards,
Andrew

from heroku-buildpack-r.

dzuelke avatar dzuelke commented on May 24, 2024

@andrewmatthewthompson Are you using https://github.com/virtualstaticvoid/heroku-buildpack-r.git#cedar-14 (mind the cedar-14 branch specification)? This change is not in master yet.

from heroku-buildpack-r.

virtualstaticvoid avatar virtualstaticvoid commented on May 24, 2024

Hi @andrewmatthewthompson

I have checked and could only replicate your issue when deploying the master branch on a cedar-14 stack.

As @dzuelke suggested, have you tried specifying the #cedar-14 branch of the buildpack?

HTH

from heroku-buildpack-r.

andrewmatthewthompson avatar andrewmatthewthompson commented on May 24, 2024

@virtualstaticvoid I think I know what happened. Someone from Heroku support simply changed my app's stack to cedar-14 without updating the R buildpack.

I've tested with changing to the cedar-14 stack while also updating to the #cedar-14 branch of the buildpack and still get an error but it's the following:

ImportError: cannot import name _compare_digest

The error comes from the following file:

File "/app/.heroku/python/lib/python2.7/hmac.py", line 8, in <module>
    from operator import _compare_digest as compare_digest

Have you come across this before by any chance?

from heroku-buildpack-r.

virtualstaticvoid avatar virtualstaticvoid commented on May 24, 2024

Hi @andrewmatthewthompson

This stackoverflow answer suggests that this error is related to the version of hmac and the Python version.

Otherwise, you could create a simple test project (much like the console test project) which includes the buildpacks and R packages you have in your configuration, so that I can try and replicate your issue.

from heroku-buildpack-r.

andrewmatthewthompson avatar andrewmatthewthompson commented on May 24, 2024

@virtualstaticvoid Thanks I'll look into that and potentially send you a test project.

Out of interest though what Python version are you running in which you couldn't replicate the issue?

from heroku-buildpack-r.

iamraybao avatar iamraybao commented on May 24, 2024

@virtualstaticvoid I initialized an empty repository with one file -- init.R -- and tried to deploy a new app to Heroku.

I typed:

ray@ray-ThinkCentre-M73 ~/test-app $ ls
init.R
ray@ray-ThinkCentre-M73 ~/test-app $ git init
Initialized empty Git repository in /home/ray/test-app/.git/
ray@ray-ThinkCentre-M73 ~/test-app $ git add .
ray@ray-ThinkCentre-M73 ~/test-app $ git commit -m "test"
[master (root-commit) 1319307] test
 1 file changed, 3 insertions(+)
 create mode 100644 init.R
ray@ray-ThinkCentre-M73 ~/test-app $ heroku create --stack cedar-14 --buildpack https://github.com/virtualstaticvoid/heroku-buildpack-r.git#cedar-14
Creating salty-chamber-5182... done, stack is cedar-14
BUILDPACK_URL=https://github.com/virtualstaticvoid/heroku-buildpack-r.git#cedar-14
https://salty-chamber-5182.herokuapp.com/ | https://git.heroku.com/salty-chamber-5182.git
Git remote heroku added
WARNING: Toolbelt v3.26.1 update available.
ray@ray-ThinkCentre-M73 ~/test-app $ git push heroku master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 278 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Fetching custom git buildpack... done
remote: 
remote:  !     Push rejected, no Cedar-supported app detected
remote: 
remote: Verifying deploy...
remote: 
remote: !   Push rejected to salty-chamber-5182.
remote: 
To https://git.heroku.com/salty-chamber-5182.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/salty-chamber-5182.git'

What am I doing wrong?

from heroku-buildpack-r.

dzuelke avatar dzuelke commented on May 24, 2024

init.r, not init.R, @takeAbao

from heroku-buildpack-r.

csatisfaction avatar csatisfaction commented on May 24, 2024

Heroku are forcing upgrades to cedar-14 as of today. I've just migrated to cedar-14 and I'm now seeing the error at the top of this post. Even though I am using the #cedar-14 buildpack link (see below). Any ideas?

remote: =====> Downloading Buildpack: http://github.com/virtualstaticvoid/heroku-buildpack-r.git
remote: =====> Detected Framework: R
remote: Vendoring R 3.2.2 for cedar-14 stack (20151031-1711)
remote: Downloading and unpacking R binaries (http://heroku-buildpack-r.s3.amazonaws.com/cedar-14/R-3.2.2-binaries-20151031-1711.tar.gz)
remote: Executing init.r script
remote: /app/vendor/R/lib64/R/bin/exec/R: error while loading shared libraries: libreadline.so.5: cannot open shared object file: No such file or directory
remote:
remote: ! Push rejected, failed to compile Multipack app
remote:

from heroku-buildpack-r.

virtualstaticvoid avatar virtualstaticvoid commented on May 24, 2024

Hi @csatisfaction

Could you try the test/console application to see whether it fails too. Clone this repo, cd test/console and run the install script in your console.

My output from running the application as follows:

remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Fetching custom buildpack https://github.com/virtualstaticvoid/heroku-buildpack-r.git#cedar-14... done
remote: -----> R app detected
remote:        Vendoring R 3.2.2 for cedar-14 stack (20151031-1711)
remote:        Downloading and unpacking R binaries (http://heroku-buildpack-r.s3.amazonaws.com/cedar-14/R-3.2.2-binaries-20151031-1711.tar.gz)
remote:        Executing init.r script
remote:        R 3.2.2 successfully installed
remote: 
remote: -----> Discovering process types
remote:        Procfile declares types -> (none)
remote: 
remote: -----> Compressing... done, 107.9MB
remote: -----> Launching... done, v3
remote:        https://blahblahblah.herokuapp.com/ deployed to Heroku
remote: 
remote: Verifying deploy... done.

from heroku-buildpack-r.

csatisfaction avatar csatisfaction commented on May 24, 2024

Will do - thanks.

from heroku-buildpack-r.

csatisfaction avatar csatisfaction commented on May 24, 2024

Sorry, am I missing something here? The output is:

Initialised empty Git repository in /tmp/tmp.D4BX1mn5qQ/.git/
[master (root-commit) a01b500] initial
3 files changed, 54 insertions(+)
create mode 100755 init.r
create mode 100755 install
create mode 100644 prog.r
Creating hidden-spire-2792... done, stack is cedar-14
BUILDPACK_URL=https://github.com/virtualstaticvoid/heroku-buildpack-r.git#cedar-14
https://hidden-spire-2792.herokuapp.com/ | https://git.heroku.com/hidden-spire-2792.git
Git remote heroku added

Has it created a dummy app that I now need to try pushing to heroku or has it done the push?

from heroku-buildpack-r.

virtualstaticvoid avatar virtualstaticvoid commented on May 24, 2024

The full output should be something like:

$ pwd
~/code/heroku-buildpack-r/cedar-14/test/console
$ ./install
/tmp/tmp.blahblah ~/code/heroku-buildpack-r/cedar-14/test/console
Initialized empty Git repository in /tmp/tmp.blahblah/.git/
[master (root-commit) 26a4db1] initial
 3 files changed, 54 insertions(+)
 create mode 100755 init.r
 create mode 100755 install
 create mode 100644 prog.r
Creating thawing-dawn-4613... done, stack is cedar-14
Buildpack set. Next release on thawing-dawn-4613 will use https://github.com/virtualstaticvoid/heroku-buildpack-r.git#cedar-14.
https://thawing-dawn-4613.herokuapp.com/ | https://git.heroku.com/thawing-dawn-4613.git
Git remote heroku added
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 929 bytes | 0 bytes/s, done.
Total 5 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Fetching custom buildpack https://github.com/virtualstaticvoid/heroku-buildpack-r.git#cedar-14... done
remote: -----> R app detected
remote:        Vendoring R 3.2.2 for cedar-14 stack (20151031-1711)
remote:        Downloading and unpacking R binaries (http://heroku-buildpack-r.s3.amazonaws.com/cedar-14/R-3.2.2-binaries-20151031-1711.tar.gz)
remote:        Executing init.r script
remote:        R 3.2.2 successfully installed
remote: 
remote: -----> Discovering process types
remote:        Procfile declares types -> (none)
remote: 
remote: -----> Compressing... done, 107.9MB
remote: -----> Launching... done, v3
remote:        https://thawing-dawn-4613.herokuapp.com/ deployed to Heroku
remote: 
remote: Verifying deploy... done.
To https://git.heroku.com/thawing-dawn-4613.git
 * [new branch]      master -> master
Running R --no-save -e "demo(nlm)" on thawing-dawn-4613... up, run.8115

R version 3.2.2 (2015-08-14) -- "Fire Safety"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> demo(nlm)


    demo(nlm)
    ---- ~~~

> #  Copyright (C) 1997-2009 The R Core Team
> 
> ### Helical Valley Function
> ### Page 362 Dennis + Schnabel
> 
> require(stats); require(graphics)

> theta <- function(x1,x2) (atan(x2/x1) + (if(x1 <= 0) pi else 0))/ (2*pi)

> ## but this is easier :
> theta <- function(x1,x2) atan2(x2, x1)/(2*pi)

> f <- function(x) {
+     f1 <- 10*(x[3] - 10*theta(x[1],x[2]))
+     f2 <- 10*(sqrt(x[1]^2+x[2]^2)-1)
+     f3 <- x[3]
+     return(f1^2+f2^2+f3^2)
+ }

> ## explore surface {at x3 = 0}
> x <- seq(-1, 2, length.out=50)

> y <- seq(-1, 1, length.out=50)

> z <- apply(as.matrix(expand.grid(x, y)), 1, function(x) f(c(x, 0)))

> contour(x, y, matrix(log10(z), 50, 50))

> str(nlm.f <- nlm(f, c(-1,0,0), hessian = TRUE))
List of 6
 $ minimum   : num 1.24e-14
 $ estimate  : num [1:3] 1.00 3.07e-09 -6.06e-09
 $ gradient  : num [1:3] -3.76e-07 3.49e-06 -2.20e-06
 $ hessian   : num [1:3, 1:3] 2.00e+02 -4.07e-02 9.77e-07 -4.07e-02 5.07e+02 ...
 $ code      : int 2
 $ iterations: int 27

> points(rbind(nlm.f$estim[1:2]), col = "red", pch = 20)

> ### the Rosenbrock banana valley function
> 
> fR <- function(x)
+ {
+     x1 <- x[1]; x2 <- x[2]
+     100*(x2 - x1*x1)^2 + (1-x1)^2
+ }

> ## explore surface
> fx <- function(x)
+ {   ## `vectorized' version of fR()
+     x1 <- x[,1]; x2 <- x[,2]
+     100*(x2 - x1*x1)^2 + (1-x1)^2
+ }

> x <- seq(-2, 2, length.out=100)

> y <- seq(-0.5, 1.5, length.out=100)

> z <- fx(expand.grid(x, y))

> op <- par(mfrow = c(2,1), mar = 0.1 + c(3,3,0,0))

> contour(x, y, matrix(log10(z), length(x)))

> str(nlm.f2 <- nlm(fR, c(-1.2, 1), hessian = TRUE))
List of 6
 $ minimum   : num 3.97e-12
 $ estimate  : num [1:2] 1 1
 $ gradient  : num [1:2] -6.54e-07 3.34e-07
 $ hessian   : num [1:2, 1:2] 802 -400 -400 200
 $ code      : int 1
 $ iterations: int 23

> points(rbind(nlm.f2$estim[1:2]), col = "red", pch = 20)

> ## Zoom in :
> rect(0.9, 0.9, 1.1, 1.1, border = "orange", lwd = 2)

> x <- y <- seq(0.9, 1.1, length.out=100)

> z <- fx(expand.grid(x, y))

> contour(x, y, matrix(log10(z), length(x)))

> mtext("zoomed in");box(col = "orange")

> points(rbind(nlm.f2$estim[1:2]), col = "red", pch = 20)

> par(op)

> fg <- function(x)
+ {
+     gr <- function(x1, x2) {
+         c(-400*x1*(x2 - x1*x1)-2*(1-x1), 200*(x2 - x1*x1))
+     }
+     x1 <- x[1]; x2 <- x[2]
+     res<- 100*(x2 - x1*x1)^2 + (1-x1)^2
+     attr(res, "gradient") <- gr(x1, x2)
+     return(res)
+ }

> nlm(fg, c(-1.2, 1), hessian = TRUE)
$minimum
[1] 1.182096e-20

$estimate
[1] 1 1

$gradient
[1]  2.583521e-09 -1.201128e-09

$hessian
        [,1]    [,2]
[1,]  802.24 -400.02
[2,] -400.02  200.00

$code
[1] 1

$iterations
[1] 24


> ## or use deriv to find the derivatives
> 
> fd <- deriv(~ 100*(x2 - x1*x1)^2 + (1-x1)^2, c("x1", "x2"))

> fdd <- function(x1, x2) {}

> body(fdd) <- fd

> nlm(function(x) fdd(x[1], x[2]), c(-1.2,1), hessian = TRUE)
$minimum
[1] 1.182096e-20

$estimate
[1] 1 1

$gradient
[1]  2.583521e-09 -1.201128e-09

$hessian
        [,1]    [,2]
[1,]  802.24 -400.02
[2,] -400.02  200.00

$code
[1] 1

$iterations
[1] 24


> fgh <- function(x)
+ {
+     gr <- function(x1, x2)
+         c(-400*x1*(x2 - x1*x1) - 2*(1-x1), 200*(x2 - x1*x1))
+     h <- function(x1, x2) {
+         a11 <- 2 - 400*x2 + 1200*x1*x1
+         a21 <- -400*x1
+         matrix(c(a11, a21, a21, 200), 2, 2)
+     }
+     x1 <- x[1]; x2 <- x[2]
+     res<- 100*(x2 - x1*x1)^2 + (1-x1)^2
+     attr(res, "gradient") <- gr(x1, x2)
+     attr(res, "hessian") <- h(x1, x2)
+     return(res)
+ }

> nlm(fgh, c(-1.2,1), hessian = TRUE)
$minimum
[1] 2.829175

$estimate
[1] -0.6786981  0.4711891

$gradient
[1] -0.4911201  2.1115987

$hessian
         [,1]     [,2]
[1,] 366.1188 271.4593
[2,] 271.4593 200.0000

$code
[1] 4

$iterations
[1] 100

> 
> 

My version of heroku-cli:

$ heroku --version
heroku-toolbelt/3.42.20 (x86_64-linux) ruby/1.9.3
heroku-cli/4.27.1-b35d19d (amd64-linux) go1.5.1

from heroku-buildpack-r.

virtualstaticvoid avatar virtualstaticvoid commented on May 24, 2024

I picked up an issue though with double-quoted command line arguments to the heroku run command, for which I've updated the test application install scripts.

from heroku-buildpack-r.

csatisfaction avatar csatisfaction commented on May 24, 2024

Thanks for all this. What I posted above was the full output though. The script finishes after "Git remote heroku added". It doesn't actually do the heroku push - which was why I wondered if I needed to do it manually.

from heroku-buildpack-r.

virtualstaticvoid avatar virtualstaticvoid commented on May 24, 2024

You can try run the steps manually to see where it fails. In the test/console directory, you would execute the following:

# create a git repo for the test app (delete the .git folder when done)
git init && git add --all && git commit -m "test"

# create a new heroku app
heroku create --stack cedar-14 --buildpack https://github.com/virtualstaticvoid/heroku-buildpack-r.git#cedar-14

# check git remote was set ~ should have a remote called "heroku"
git remote -v  

# deploy
git push heroku master

# assuming succeeded to deploy, run some R code
heroku run 'R --no-save -e "demo(nlm)"' 

from heroku-buildpack-r.

csatisfaction avatar csatisfaction commented on May 24, 2024

Thanks again. I just got a chance to run through this. All steps execute successfully - the heroku push is ok and the command executes.

However, I still the same issue when deploying the buildpack in my app:

remote: =====> Downloading Buildpack: http://github.com/virtualstaticvoid/heroku-buildpack-r.git
remote: =====> Detected Framework: R
remote: Vendoring R 3.2.2 for cedar-14 stack (20151031-1711)
remote: Downloading and unpacking R binaries (http://heroku-buildpack-r.s3.amazonaws.com/cedar-14/R-3.2.2-binaries-20151031-1711.tar.gz)
remote: Executing init.r script
remote: /app/vendor/R/lib64/R/bin/exec/R: error while loading shared libraries: libreadline.so.5: cannot open shared object file: No such file or directory
remote:
remote: ! Push rejected, failed to compile Multipack app
remote:
remote: Verifying dep

I'm definitely on cedar-14 and I can see from the output (above) that is using the cedar-14 buildpack. Any ideas?

from heroku-buildpack-r.

virtualstaticvoid avatar virtualstaticvoid commented on May 24, 2024

Are you using multiple buildpacks? Perhaps one of the others is affecting the environment variables, such as LIBRARY_PATH.

from heroku-buildpack-r.

csatisfaction avatar csatisfaction commented on May 24, 2024

I am using multiple buildpacks. The conflict seems to be with heroku's own buildpack: heroku-buildpack-ruby. It was ordered before the buildpack-r and causing the error whilst pushing to heroku.

(Note: this has been working fine for over a year on the old cedar-10)

If I change the buildpack order so that builpack-r comes before buildpack-ruby then I can now successfully deploy to heroku. However... I then encounter the same error when running the app. From the logs:

Nov 06 03:41:43 app/web.1: /app/vendor/R/lib64/R/bin/exec/R: error while loading shared libraries: libreadline.so.5: cannot open shared object file: No such file or directory

The LIBRARY_PATH on heroku is:

/app/vendor/.apt/usr/lib/x86_64-linux-gnu:/app/vendor/.apt/usr/lib/i386-linux-gnu:/app/vendor/.apt/usr/lib:

from heroku-buildpack-r.

virtualstaticvoid avatar virtualstaticvoid commented on May 24, 2024

@csatisfaction I've created issue #57 to deal with you issue.

from heroku-buildpack-r.

MatthewJChang avatar MatthewJChang commented on May 24, 2024

buildpacknotworking

Does anybody know why my "git push heroku master" command is not working? It can fetch the set buildpack "https://github.com/virtualstaticvoid/heroku-buildpack-r.git" but is not able to detect the set when it pushes, so the push is rejected.

from heroku-buildpack-r.

cstefano avatar cstefano commented on May 24, 2024

Hi @MatthewJChang

Do you have the init.r file located in the root directory of your project?

The buildpack checks for the existence of this file, and executes it in order the install any additional packages required by your project.

from heroku-buildpack-r.

MatthewJChang avatar MatthewJChang commented on May 24, 2024

@cstefano Yes, it shows up on my Windows as init.R (should it be a problem that R is capitalized)? The root directory (in my case BearsontheGoHeroku) should be the same directory that my ui.R and server.R files are in, right (I am using shiny)? What exactly needs to be in the init.R file? Right now, it's blank. I don't remember installing any R packages for implementing my code. However, what if I did, and the fact that the required install.packages() statements aren't there is what is causing the init.R file to fail?

bearsonthegoherokuproblem

from heroku-buildpack-r.

cstefano avatar cstefano commented on May 24, 2024

Hi @MatthewJChang

Yes, the detection is case-sensitive, so init.R won't work. I guess this is a bug, so I will change it to be case-insensitive.

The init.r file contains R code to install packages. There are examples of this in the test applications.

E.g. In the following R code, add the package name(s) to install to the my_packages variable.

#
# Example R code to install packages
# See http://cran.r-project.org/doc/manuals/R-admin.html#Installing-packages for details
#

###########################################################
# Update this line with the R packages to install:

my_packages = c("<insert package name here>")

###########################################################

install_if_missing = function(p) {
  if (p %in% rownames(installed.packages()) == FALSE) {
    install.packages(p, dependencies = TRUE)
  }
  else {
    cat(paste("Skipping already installed package:", p, "\n"))
  }
}
invisible(sapply(my_packages, install_if_missing))

If your app uses any non-default packages, which aren't installed by init.r, then your app will fail. Just look for any library calls in your code to see which packages you're using.

from heroku-buildpack-r.

MatthewJChang avatar MatthewJChang commented on May 24, 2024

Hi Chris,

  Thanks for all the help. Do you think that changing init.r to be

case-insensitive will be an easy fix? When can I expect the update to be
made (at which point I will need to reset the buildpack) and run "git push
heroku master" again?
Also, just to double check, if I am using shiny and did not use any
non-default packages, I should have the following in my init.R file, right?

Example R code to install packages# See

http://cran.r-project.org/doc/manuals/R-admin.html#Installing-packages for
details# ############################################################
Update this line with the R packages to install: my_packages = c("shiny")
###########################################################
install_if_missing = function(p) { if (p %in%
rownames(installed.packages()) == FALSE) { install.packages(p, dependencies
= TRUE) } else { cat(paste("Skipping already installed package:", p, "\n"))
}}invisible(sapply(my_packages, install_if_missing))

On Sun, Jan 3, 2016 at 11:42 AM, Chris Stefano [email protected]
wrote:

Hi @MatthewJChang https://github.com/MatthewJChang

Yes, the detection is case-sensitive
https://github.com/virtualstaticvoid/heroku-buildpack-r/blob/cedar-14/bin%2Fdetect#L4,
so init.R won't work. I guess this is a bug, so I will change it to be
case-insensitive.

The init.r file contains R code to install packages. The are examples of
this in the test applications
https://github.com/virtualstaticvoid/heroku-buildpack-r/tree/cedar-14/test.

E.g. In the following R code, add the package name(s) to install to the
my_packages variable.

Example R code to install packages

See http://cran.r-project.org/doc/manuals/R-admin.html#Installing-packages for details

###########################################################

Update this line with the R packages to install:

my_packages = c("")

###########################################################

install_if_missing = function(p) {
if (p %in% rownames(installed.packages()) == FALSE) {
install.packages(p, dependencies = TRUE)
}
else {
cat(paste("Skipping already installed package:", p, "\n"))
}
}
invisible(sapply(my_packages, install_if_missing))

If your app uses any non-default packages, which aren't installed by
init.r, then your app will fail. Just look for any library calls in your
code to see which packages you're using.


Reply to this email directly or view it on GitHub
#39 (comment)
.

from heroku-buildpack-r.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.