1

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     
Community
  • 1
  • 1
Rich Scriven
  • 97,041
  • 11
  • 181
  • 245
  • 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 May 21 '14 at 21:14
  • @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 it` – Rich Scriven May 21 '14 at 21:22
  • 1
    Ok, but you still haven't said which distro you are using. – Dirk Eddelbuettel May 21 '14 at 21:24
  • 1
    (1) I'm not sure why `lme4` wouldn't be available for 3.1 ([package checks](http://cran.r-project.org/web/checks/check_results_lme4.html) and [CRAN page](http://cran.r-project.org/web/packages/lme4/index.html) 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 texinfo](http://stackoverflow.com/questions/17652698/texi2dvi-command-not-found) – Ben Bolker May 22 '14 at 00:13
  • Do you have a .Rprofile with .first and .last specified - this caused me issues. If so try temporarily deleting it and try installing lme4 again. – user20650 May 22 '14 at 01:23
  • @user20650, yes. I actually just added it a few days ago. I was wondering why my `.First` message was appearing in the error streams. – Rich Scriven May 22 '14 at 01:34
  • I just pushed a possible fix. If you have access to development tools (assume so since you're on Ubuntu), could you try `devtools::github_install("lme4","lme4")` and let me know if it works? – Ben Bolker May 23 '14 at 23:37
  • thanks @DirkEddelbuettel the command `sudo apt-get install r-cran-lme4` make it work for me ! – SkyR Jul 09 '18 at 20:27

4 Answers4

2

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
user20650
  • 24,654
  • 5
  • 56
  • 91
  • Many thanks to you! This worked perfectly. I have no clue why the `.Rprofile` affects `lme4` install, but for now I'm not concerned. Thanks again. – Rich Scriven May 22 '14 at 23:18
  • @RichardScriven; your welcome. Yes, i don't understand either but the `.First` will interfere with the install of multiple packages (so i removed mine). Anyway adding the profile was a case of idle hands being the devils playthings. – user20650 May 23 '14 at 00:05
  • I hope to look into this, but don't know how soon I can get to it. If you'd like you can add an issue at https://github.com/lme4/lme4/issues – Ben Bolker May 23 '14 at 02:19
2

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?)

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
1

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...

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • 1
    FWIW I have `lme4` working just fine on Ubuntu 12.04 – Ben Bolker May 22 '14 at 00:14
  • We all do. The Travis CI infrastructure uses 12.04 as well. And building from source works well for most people, including you and me. – Dirk Eddelbuettel May 22 '14 at 00:19
  • 1
    Then I don't quite understand your first bullet point above: what's wrong with installing 3.1.0 on 12.04? – Ben Bolker May 22 '14 at 00:27
  • Breaks r-cran-lme4 from the distro which was built against the then current 2.* whatever, yielding the error in his comment below his question. – Dirk Eddelbuettel May 22 '14 at 00:28
  • Honestly, I have been much happier with R on Ubuntu over Windows since I made the switch. This is really the first install problem I've had. I may be a linux-lifer now. It's all so much better and Ubuntu never tells me "I'm not responding" :) – Rich Scriven May 22 '14 at 00:32
  • @DirkEddelbuettel, turns out it was my `.First` call in my `.Rprofile` that was causing the problem. Got it sorted out now but if you know why that problem occurs, I'd like to know. – Rich Scriven May 23 '14 at 00:58
  • 1
    Just wrap it in `if (interactive()) {}`. You can have code in `.Rprofile`. – Dirk Eddelbuettel May 23 '14 at 01:27
  • Yes, but the failure was really the package's fault (output of `Rscript -e` was being fed to an environment variable in `src/Makevars` -- added `--vanilla`) – Ben Bolker May 24 '14 at 00:59
  • I see. We learned that lesson the hard way too as `Rcpp` used to have such `Rscript` calls. – Dirk Eddelbuettel May 24 '14 at 01:00
0
 sudo apt-get install r-base-dev

solved the problem for me

chollida
  • 7,834
  • 11
  • 55
  • 85
jr1
  • 1
  • 1