1
votes

EDIT :

Many thanks to user20650, whose answer solved this problem. But if anyone knows why the .Rprofile file affects lme4 install on Ubuntu 12.04, please advise because I'd really like to know.


Original post :

I'm attempting to install the doBy package and am having some issues. It depends on lme4, which for some reason is not compiling from any source I've tried so far. I've been to a few links on SO including this one and haven't had any success.

Here are snippets of the errors I'm getting on install. I tried it three different ways, as noted below. Anyone know if something's up with lme4?

Attempt 1:

> install.packages('doBy')
# ...
# ERROR: compilation failed for package ‘lme4’
# * removing ‘/home/richard/R/x86_64-pc-linux-gnu-library/3.1/lme4’
# Warning in install.packages :
#   installation of package ‘lme4’ had non-zero exit status
# 
# Successfully loaded .Rprofile at Wed May 21 13:33:34 2014 
# ERROR: dependency ‘lme4’ is not available for package ‘doBy’
# * removing ‘/home/richard/R/x86_64-pc-linux-gnu-library/3.1/doBy’
# Warning in install.packages :
#   installation of package ‘doBy’ had non-zero exit status

Attempt 2:

> install.packages("lme4",repos = "http://r-forge.r-project.org")
# Installing package into ‘/home/richard/R/x86_64-pc-linux-gnu-library/3.1’
# (as ‘lib’ is unspecified)
# Warning in install.packages :
#   package ‘lme4’ is not available (for R version 3.1.0)

Attempt 3:

> install_github(repo = 'lme4/lme4', username = 'stevencarlislewalker')

enter image description here


Running Ubuntu 12.04 LTS

> version
# _                           
# platform       x86_64-pc-linux-gnu         
# arch           x86_64                      
# os             linux-gnu                   
# system         x86_64, linux-gnu           
# status                                     
# major          3                           
# minor          1.0                         
# year           2014                        
# month          04                          
# day            10                          
# svn rev        65387                       
# language       R                           
# version.string R version 3.1.0 (2014-04-10)
# nickname       Spring Dance     
4
Maybe sudo apt-get install r-cran-lme4 can help? Else you could try to backtrack to older source versions using the CRAN Archive...Dirk Eddelbuettel
@DirkEddelbuettel, well that got me a bit closer. Now it's in my list, but I get Error: package ‘lme4’ was built before R 3.0.0: please re-install itRich Scriven
Ok, but you still haven't said which distro you are using.Dirk Eddelbuettel
(1) I'm not sure why lme4 wouldn't be available for 3.1 (package checks and CRAN page both look fine). (2) I'm not really surprised that lme4 isn't building on R-forge, but try repos="http://lme4.r-forge.r-project.org/repos" (3) sudo apt-get install texinfoBen Bolker
Thanks @BenBolker, I'll give it a try.Rich Scriven

4 Answers

2
votes

This (possibly) may not be an answer to Richard's Q. but does replicate a problem i had installing lme4 on ubuntu 12,04 on Rv3.1. It would be good if others could reproduce this.

So following on from my comment - noticing that Richard had a .Rprofile, defining .First and .Last in my .Rprofile caused packages not to install.

Exmaple

First uninstall lme4

remove.packages("lme4")

Define .Rprofile file

## .First() run at the start of every R session.
.First <- function() {
cat("\nSuccessfully loaded your .Rprofile at", date(), "\n")
}

## .Last() run at the end of the session
.Last <- function() {
cat("\nGoodbye at ", date(), "\n")
}

Open R

Try an install lme4 - no success & similar error to Richard's above

install.packages("lme4")

...
* removing ‘/home/admin1/R/i686-pc-linux-gnu-library/3.1/lme4’
Warning in install.packages :
  installation of package ‘lme4’ had non-zero exit status

So rename (or remove) .Rprofile file in terminal

mv .Rprofile temp.Rprofile

Open R again and try to install lme4

install.packages("lme4")

...
* installing vignettes
** testing if installed package can be loaded
* DONE (lme4)

 library(lme4)
# Loading required package: Matrix
# Loading required package: Rcpp
2
votes

This was a bug, should be fixed by this commit in the development version (on Github) and in release 1.1-7 when it comes out (soon?)

1
votes

Based on your comments and expanded questions:

  • You are shooting yourself in the foot by installing R 3.1.0 onto Ubuntu 12.04.

  • You now run an R that is out of sync with packages like r-cran-lme4 in the distro.

  • The good news is that you can ask the distribution for information about the so-called Build-Depends it knows, and rebuild lme4 under R 3.1.0

  • Or can benefit from Michael's other work over at launchpad and use his other repo which is what eg the r-travis code does: sudo add-apt-repository -y "ppa:marutter/rrutter" followed by and sudo add-apt-repository -y "ppa:marutter/c2d4u"

That last step will give you loads of pre-built packages. In the long run you are of course better off being to able to build packages from source yourself...

0
votes
 sudo apt-get install r-base-dev

solved the problem for me