Skip to content

install.packages() fails if .libPaths() set

6 messages · Hadley Wickham, Uwe Ligges, Winston Chang

#
Reproducible example:

dir.create("test")
.libPaths("test")
install.packages("relations", type = "source")

Fails with:

...
* installing *source* package ?relations? ...
...
** testing if installed package can be loaded
*** arch - i386
Error : package ?sets? required by ?relations? could not be found
Error: loading failed
Execution halted
*** arch - x86_64
Error : package ?sets? required by ?relations? could not be found
Error: loading failed
Execution halted
ERROR: loading failed for ?i386?, ?x86_64?

If I don't set .libPaths() it installs without error.

This is on a fairly recent version of R-devel (Oct 3) and on R 2.15.1

Hadley
#
On 29.10.2012 23:35, Hadley Wickham wrote:
Yes, since your package set is installed in a library that is not 
"test". And you have omitted that library from the search path by 
changing .libPaths().

Uwe Ligges
#
I'm not sure I follow. I thought install.packages() installs into the
first element of .libPaths(), and indeed I get this message:

Installing package into ?/Users/hadley/Desktop/test?
(as ?lib? is unspecified)

Hadley
#
On 30.10.2012 15:01, Hadley Wickham wrote:
Yes, but "sets" is not there.

Uwe
#
I'm trying to understand why it's not there - if install.packages()
installs dependent packages does it put them somewhere else?

Hadley
#
It appears that this problem only happens when R_LIBS is specified in
~/.Renviron. When it compiles 'relations', it's somehow not passing
along the correct lib paths.


This is the test code:
dir.create("test")
.libPaths("test")
install.packages("relations", type = "source")


The 'relations' package depends on 'sets' and 'slam'. When there is no
~/.Renviron file it works: all three packages get installed into
test/.


The story is different when there is an file ~/.Renviron with the contents:
R_LIBS=~/R

(And the ~/R directory exists, of course.)

It manages to install 'sets' and 'slam' into test/, but it fails to
install 'relations'. I've added the output to the bottom of this
email.

I test this with  R 2.15.1 and R 2.15.2 on Windows XP, and R 2.15.1 on
Mac OS X 10.7.5. In all cases, I get the same result.


Here's the output when there _is_ an .Renviron file:
Installing package(s) into ?C:/Documents and Settings/user/My Documents/test?
(as ?lib? is unspecified)
also installing the dependencies ?sets?, ?slam?

trying URL 'http://cran.rstudio.com/src/contrib/sets_1.0-11.tar.gz'
Content type 'application/x-gzip' length 283388 bytes (276 Kb)
opened URL
downloaded 276 Kb

trying URL 'http://cran.rstudio.com/src/contrib/slam_0.1-26.tar.gz'
Content type 'application/x-gzip' length 39506 bytes (38 Kb)
opened URL
downloaded 38 Kb

trying URL 'http://cran.rstudio.com/src/contrib/relations_0.6.tar.gz'
Content type 'application/x-gzip' length 493292 bytes (481 Kb)
opened URL
downloaded 481 Kb

* installing *source* package 'sets' ...
** package 'sets' successfully unpacked and MD5 sums checked
** libs
cygwin warning:
  MS-DOS style path detected: C:/R/R-215~1.1/etc/i386/Makeconf
  Preferred POSIX equivalent is: /cygdrive/c/R/R-215~1.1/etc/i386/Makeconf
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
gcc  -I"C:/R/R-215~1.1/include" -DNDEBUG          -O3 -Wall
-std=gnu99 -mtune=core2 -c closure.c -o closure.o
gcc -shared -s -static-libgcc -o sets.dll tmp.def closure.o
-LC:/R/R-215~1.1/bin/i386 -lR
installing to C:/Documents and Settings/user/My Documents/test/sets/libs/i386
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
   'sets.Rnw'
** testing if installed package can be loaded

* DONE (sets)
* installing *source* package 'slam' ...
** package 'slam' successfully unpacked and MD5 sums checked
** libs
cygwin warning:
  MS-DOS style path detected: C:/R/R-215~1.1/etc/i386/Makeconf
  Preferred POSIX equivalent is: /cygdrive/c/R/R-215~1.1/etc/i386/Makeconf
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
gcc  -I"C:/R/R-215~1.1/include" -DNDEBUG          -O3 -Wall
-std=gnu99 -mtune=core2 -c grouped.c -o grouped.o
gcc  -I"C:/R/R-215~1.1/include" -DNDEBUG          -O3 -Wall
-std=gnu99 -mtune=core2 -c sparse.c -o sparse.o
gcc  -I"C:/R/R-215~1.1/include" -DNDEBUG          -O3 -Wall
-std=gnu99 -mtune=core2 -c util.c -o util.o
gcc -shared -s -static-libgcc -o slam.dll tmp.def grouped.o sparse.o
util.o -LC:/R/R-215~1.1/bin/i386 -lRblas -lgfortran
-LC:/R/R-215~1.1/bin/i386 -lR
installing to C:/Documents and Settings/user/My Documents/test/slam/libs/i386
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded

* DONE (slam)
* installing *source* package 'relations' ...
** package 'relations' successfully unpacked and MD5 sums checked
** R
** data
**  moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
   'relations.Rnw'
** testing if installed package can be loaded
Error : package 'sets' required by 'relations' could not be found
Error: loading failed
Execution halted
ERROR: loading failed
* removing 'C:/Documents and Settings/user/My Documents/test/relations'
Warning in install.packages :
  running command 'C:/R/R-215~1.1/bin/i386/R CMD INSTALL -l
"C:/Documents and Settings/user/My Documents/test"
C:\DOCUME~1\user\LOCALS~1\Temp\RtmpGSxf4J/downloaded_packages/relations_0.6.tar.gz'
had status 1
Warning in install.packages :
  installation of package ?relations? had non-zero exit status

The downloaded source packages are in
?C:\Documents and Settings\user\Local
Settings\Temp\RtmpGSxf4J\downloaded_packages?