问题
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')
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
回答1:
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:
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?)
回答3:
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 andsudo 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...
回答4:
sudo apt-get install r-base-dev
solved the problem for me
来源:https://stackoverflow.com/questions/23793870/lme4-package-install-failing-on-ubuntu-12-04