[R-sig-Debian] Patchy 'front-end' package installation problems using -R- 2.15.1

Paul Johnson pauljohn32 at gmail.com
Tue Jul 24 07:32:33 CEST 2012


Greetings, Clive:

Next time, just post about one problem.

I'm answering some specifics down in the middle of your message, but
here's the basic idea. Once you get a "grip" on a fundamental
misconception that is driving your message, the details I give will
seem superfluous to you. It seems to me you are missing the
fundamental big idea.

On Linux, the "install.packages" command inside R does not "load"
packages. Instead, it downloads them and COMPILES them. That requires
software for COMPILING programs.  If your system DOES NOT HAVE the
assumed packages, then the R package installs fail. Read each
individual error message. You need to install more Debian packages on
your system in order for those COMPILES to succeed.  Some uses of
install.packages inside R may succeed if they do not call for fortran
or C compilers, or linkage to other libraries.  But most won't.

That is COMPLETELY different from MS Windows, on which all packages
are "pre-compiled" for you and when you run "install.packages" inside
R, it just downloads and installs the pre-compiled files.

I think this is a character building Linux experience for you. You
learn how to install the requisite Debian software packages and learn
something about compiling software and reading error messages.  If you
were my student, I'd say "keep trying, it is the only way you will
become a well qualified Linux user." In errors below, you will see
your first step is to install fortran and C++ compilers.

Not everybody agrees with me on that. So they do that work for you and
package them as Debian packages.  Dirk Eddelbuettel has worked very
hard to automate R package builds that go into debian packages.  Some
are in the base of Ubuntu.  But there are 1000s more that are
automatically built.  In your output below, I see you get success from
apt-get with the package

r-cran-hmisc

Those are Debian packages that have essentially the same compiled
files in them that you would get if you could compile the packages for
ourself inside R in your system.

I'm unsure of how many Debian packages you will find for your Kubuntu
setup. The shared library versions must match, and if your system
differs from Debian, there will be trouble.  On my Debian system, It
appears I'm drawing R packages from 2 sources.  I have the "ordinary"
distribution channel, plus I have configured a repo file for CRAN
updates.  I think the CRAN updates are vital mainly for R-base itself.
 That's setup like so

$ cat /etc/apt/sources.list.d/cran.list
 deb http://cran.wustl.edu/bin/linux/debian squeeze-cran/

Go read this folder:

http://cran.wustl.edu/bin/linux/debian/squeeze-cran

You see the Debian packages that I get from the R CRAN mirrors.  I
note hmisc is not one of them.  But hmisc is listed among the 100s I
see when I run:

$ apt-cache search cran

So, well, my point is that "R packages" and "Debian packages" may
exist for the same thing, and you can install both, or one, or the
other, but please don't forget that they are not identical because you
have to compile the R packages but the Debian packages are
pre-compiled.  Good luck. see details below.

pj

On Mon, Jul 23, 2012 at 10:26 PM, CLIVE NICHOLAS
<clivenicholas at hotmail.com> wrote:
>
> I think this is the fourth attempt to send this blessed message, so let's hope this gets through without any 'unprocessed' or 'ignored' in-lines on auto-reply.
> I wish to report to you some strange problems I'm experiencing with installing packages directly into my -R- 2.15.1 (there is an indirect solution, which I note below). First, here's some essential information:
>> sessionInfo()R version 2.15.1 (2012-06-22)
> Platform: i686-pc-linux-gnu (32-bit)
>
> locale:
>  [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8
>  [4] LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8
>  [7] LC_PAPER=C                 LC_NAME=C                  LC_ADDRESS=C
> [10] LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> loaded via a namespace (and not attached):
> [1] tools_2.15.1
> Essentially, some packages are installing 'at the front end' and some are not, but this has only been happening since I re-enabled the 'other software sources' inside the Muon Software Centre settings on my Kubuntu 12.04 OS (I only discovered earlier this month that they are always disabled when Kubuntu upgrades to the next full version). Fixing this automatically triggered the updates for the latest version of -R- (successfully installed), but when I then attempted to install the -lme4- package shortly afterwards
>> install.packages("lme4")Installing package(s) into ‘/home/clive/R/i686-pc-linux-gnu-library/2.15’(as ‘lib’ is unspecified)trying URL 'http://cran.ma.imperial.ac.uk/src/contrib/lme4_0.999999-0.tar.gz'Content type 'application/x-gzip' length 1074142 bytes (1.0 Mb)opened URL==================================================downloaded 1.0 Mb
> * installing *source* package ‘lme4’ ...** package ‘lme4’ successfully unpacked and MD5 sums checked** libs/usr/share/R/share/make/shlib.mk:6: warning: overriding commands for target `lme4.so'Makevars:7: warning: ignoring old commands for target `lme4.so'gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG   -I"/usr/lib/R/library/Matrix/include" -I"/usr/lib/R/library/stats/include"   -fpic  -O3 -pipe  -g  -c init.c -o init.ogcc -std=gnu99 -I/usr/share/R/include -DNDEBUG   -I"/usr/lib/R/library/Matrix/include" -I"/usr/lib/R/library/stats/include"   -fpic  -O3 -pipe  -g  -c lmer.c -o lmer.ogcc -std=gnu99 -I/usr/share/R/include -DNDEBUG   -I"/usr/lib/R/library/Matrix/include" -I"/usr/lib/R/library/stats/include"   -fpic  -O3 -pipe  -g  -c local_stubs.c -o local_stubs.ogcc -std=gnu99 -shared -o lme4.so init.o lmer.o local_stubs.o -llapack -lblas -lgfortran -lm -L/usr/lib/R/lib -lR/usr/bin/ld: cannot find -llapack/usr/bin/ld: cannot find -lblas/usr/bin/ld: cannot find -lgfortrancollect2: ld returned 1 exit statusmake: *** [lme4.so] Error 1ERROR: compilation failed for package ‘lme4’* removing ‘/home/clive/R/i686-pc-linux-gnu-library/2.15/lme4’Warning in install.packages :  installation of package ‘lme4’ had non-zero exit status

Read the errors please. The compile cannot find the lapack and blas
development packages.  And fortran (gfortran).  On my Debian system,
for those I have

gfortran
libatlas-dev
libatlas3gf-base
libblas-dev

Your Ubuntu may vary

> The downloaded source packages are in   ‘/tmp/RtmpUFK3Hz/downloaded_packages’
> it failed. It also failed for -rms-
>> install.packages("rms")Installing package(s) into ‘/home/clive/R/i686-pc-linux-gnu-library/2.15’(as ‘lib’ is unspecified)also installing the dependency ‘Hmisc’
> trying URL 'http://cran.ma.imperial.ac.uk/src/contrib/Hmisc_3.9-3.tar.gz'Content type 'application/x-gzip' length 573945 bytes (560 Kb)opened URL==================================================downloaded 560 Kb
> trying URL 'http://cran.ma.imperial.ac.uk/src/contrib/rms_3.5-0.tar.gz'Content type 'application/x-gzip' length 368054 bytes (359 Kb)opened URL==================================================downloaded 359 Kb
> * installing *source* package ‘Hmisc’ ...** package ‘Hmisc’ successfully unpacked and MD5 sums checked** libsgcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c Hmisc.c -o Hmisc.ogfortran   -fpic  -O3 -pipe  -g  -c cidxcn.f -o cidxcn.o/bin/bash: gfortran: command not foundmake: *** [cidxcn.o] Error 127ERROR: compilation failed for package ‘Hmisc’* removing ‘/home/clive/R/i686-pc-linux-gnu-library/2.15/Hmisc’Warning in install.packages :  installation of package ‘Hmisc’ had non-zero exit statusERROR: dependency ‘Hmisc’ is not available for package ‘rms’* removing ‘/home/clive/R/i686-pc-linux-gnu-library/2.15/rms’Warning in install.packages :  installation of package ‘rms’ had non-zero exit status

Read y our error message. "gfortran not found".


> The downloaded source packages are in   ‘/tmp/RtmpUFK3Hz/downloaded_packages’
> and for -lmtest-
>> install.packages("lmtest")Installing package(s) into ‘/home/clive/R/i686-pc-linux-gnu-library/2.15’(as ‘lib’ is unspecified)trying URL 'http://cran.ma.imperial.ac.uk/src/contrib/lmtest_0.9-30.tar.gz'Content type 'application/x-gzip' length 176106 bytes (171 Kb)opened URL==================================================downloaded 171 Kb
> * installing *source* package ‘lmtest’ ...** package ‘lmtest’ successfully unpacked and MD5 sums checked** libsgfortran   -fpic  -O3 -pipe  -g  -c pan.f -o pan.o/bin/bash: gfortran: command not foundmake: *** [pan.o] Error 127ERROR: compilation failed for package ‘lmtest’* removing ‘/home/clive/R/i686-pc-linux-gnu-library/2.15/lmtest’Warning in install.packages :  installation of package ‘lmtest’ had non-zero exit status

Same

> The downloaded source packages are in   ‘/tmp/RtmpUFK3Hz/downloaded_packages’
> It did, however, work for -car-> install.packages("car")Installing package(s) into ‘/home/clive/R/i686-pc-linux-gnu-library/2.15’(as ‘lib’ is unspecified)trying URL 'http://cran.ma.imperial.ac.uk/src/contrib/car_2.0-12.tar.gz'Content type 'application/x-gzip' length 319291 bytes (311 Kb)opened URL==================================================downloaded 311 Kb* installing *source* package ‘car’ ...** package ‘car’ successfully unpacked and MD5 sums checked** R** data**  moving datasets to lazyload DB** inst** byte-compile and prepare package for lazy loading** help*** installing help indices** building package indices** testing if installed package can be loaded* DONE (car)The downloaded source packages are in        ‘/tmp/RtmpHQHTwB/downloaded_packages’
> and for -ggplot2- (output much too long to include here!). This has never happened to me in all the years I have casually used -R-, either on Windows or Linux. This problem is now occurring regardless of whether I use RStudio, as I am currently (v0.96.304), or when running -R- from the Konsole terminal; although this would be perhaps unsurprising to you. All of the above attempts had the option to install dependencies selected.


This is COMPLETELY IRRELEVANT.  Your OS is missing most of the
required development Debian packages.  Install gfortran and atlas and
blas support and try again. I'm sure you'll also need a C++ compiler
as well.

On the debian pages for R updates,

http://cran.r-project.org/bin/linux/debian

Create a debian apt repostiory file in your system, then run

 apt-get update
 apt-get install r-base r-base-dev




> Now, after rifling the list archives, I found that the following post
> https://stat.ethz.ch/pipermail/r-sig-debian/2011-November/001711.html
> pointed to a solution from the terminal, which worked:
> clive at clivubu:~$ sudo apt-get install r-cran-lme4[sudo] password for clive: Reading package lists... DoneBuilding dependency tree       Reading state information... DoneThe following NEW packages will be installed  r-cran-lme40 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.Need to get 1,231 kB of archives.After this operation, 1,634 kB of additional disk space will be used.Get:1 http://gb.archive.ubuntu.com/ubuntu/ precise/universe r-cran-lme4 i386 0.999375-42-1 [1,231 kB]Fetched 1,231 kB in 3s (335 kB/s)        Selecting previously unselected package r-cran-lme4.(Reading database ... 199646 files and directories currently installed.)Unpacking r-cran-lme4 (from .../r-cran-lme4_0.999375-42-1_i386.deb) ...Setting up r-cran-lme4 (0.999375-42-1) ...
> clive at clivubu:~$ sudo apt-get install r-cran-lmtestReading package lists... DoneBuilding dependency tree       Reading state information... DoneThe following extra packages will be installed:  r-cran-zooThe following NEW packages will be installed  r-cran-lmtest r-cran-zoo0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.Need to get 1,761 kB of archives.After this operation, 2,207 kB of additional disk space will be used.Do you want to continue [Y/n]? yGet:1 http://gb.archive.ubuntu.com/ubuntu/ precise/universe r-cran-zoo i386 1.7-6-1 [1,389 kB]Get:2 http://gb.archive.ubuntu.com/ubuntu/ precise/universe r-cran-lmtest i386 0.9.29-1 [372 kB]Fetched 1,761 kB in 3s (471 kB/s)      Selecting previously unselected package r-cran-zoo.(Reading database ... 199695 files and directories currently installed.)Unpacking r-cran-zoo (from .../r-cran-zoo_1.7-6-1_i386.deb) ...Selecting previously unselected package r-cran-lmtest.Unpacking r-cran-lmtest (from .../r-cran-lmtest_0.9.29-1_i386.deb) ...Setting up r-cran-zoo (1.7-6-1) ...Setting up r-cran-lmtest (0.9.29-1) ...
> clive at clivubu:~$ sudo apt-get install r-cran-rmsReading package lists... DoneBuilding dependency tree                                                                                                                                                            Reading state information... Done                                                                                                                                                   The following extra packages will be installed:                                                                                                                                       r-cran-chron r-cran-hmisc                                                                                                                                                         The following NEW packages will be installed                                                                                                                                          r-cran-chron r-cran-hmisc r-cran-rms                                                                                                                                              0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.Need to get 2,394 kB of archives.After this operation, 2,768 kB of additional disk space will be used.Do you want to continue [Y/n]? yGet:1 http://gb.archive.ubuntu.com/ubuntu/ precise/universe r-cran-chron i386 2.3-42-1 [87.4 kB]Get:2 http://gb.archive.ubuntu.com/ubuntu/ precise/universe r-cran-hmisc i386 3.9-0-1 [1,395 kB]Get:3 http://gb.archive.ubuntu.com/ubuntu/ precise/universe r-cran-rms i386 3.3-3-1 [911 kB]Fetched 2,394 kB in 6s (385 kB/s)                                                                                                                                                  Selecting previously unselected package r-cran-chron.(Reading database ... 199800 files and directories currently installed.)Unpacking r-cran-chron (from .../r-cran-chron_2.3-42-1_i386.deb) ...Selecting previously unselected package r-cran-hmisc.Unpacking r-cran-hmisc (from .../r-cran-hmisc_3.9-0-1_i386.deb) ...Selecting previously unselected package r-cran-rms.Unpacking r-cran-rms (from .../r-cran-rms_3.3-3-1_i386.deb) ...Setting up r-cran-chron (2.3-42-1) ...Setting up r-cran-hmisc (3.9-0-1) ...Setting up r-cran-rms (3.3-3-1) ...
> That's good, but the question which now remains is simply this: why are some packages not loading via -install.packages()- when others do? Has anyone else experienced this difficulty?
> I can only hope and trust that any list members reading this have spotted some crucial nugget(s) of information in the output I have provided to suggest an answer.
> Many thanks.
> Yours, Clive Nicholas
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-SIG-Debian mailing list
> R-SIG-Debian at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-debian
>



-- 
Paul E. Johnson
Professor, Political Science    Assoc. Director
1541 Lilac Lane, Room 504     Center for Research Methods
University of Kansas               University of Kansas
http://pj.freefaculty.org            http://quant.ku.edu



More information about the R-SIG-Debian mailing list