[R-sig-Debian] little "r" cannot find packages

Dirk Eddelbuettel edd at debian.org
Thu Nov 26 23:12:29 CET 2009


On 26 November 2009 at 20:08, Stefan Franke wrote:
| Dear All
| 
| I want to use R, Rscript und r alternately under 
| one common configuration. 
| The problem is that \"r\" can't find the package \"Rmpi\"
| and other packages whereas \"R\" has no problem to find. 
| 
| $ R --vanilla < mpiHelloWorld.r
| 
|  #!/usr/bin/env r
|  library(Rmpi) # calls MPI_Init
|  rk <- mpi.comm.rank(0)
|  sz <- mpi.comm.size(0)
|  name <- mpi.get.processor.name()
|  cat( \"Hello, rank \" , rk, \"size\", sz, \"on\", name, \"\\n\")
| 
| Hello, rank 0 size 1 on lenny157 # ok.
| 
| $ Rscript mpiHelloWorld.r
| Hello, rank 0 size 1 on lenny157 # ok.
| 
| $ r mpiHelloWorld.r
| Error in library(Rmpi) : there is no package called 'Rmpi'
| 
| $ r -lRmpi -e 'cat(\"Hello\", mpi.get.processor.name())'
| Error in library(Rmpi) : there is no package called 'Rmpi'
| 
| $ R --version
| R version 2.9.2 (2009-08-24)
| 
| $r --version
| r ('littler') version 0.1.0
| 
| I have installed the binaries for Lenny using apt-get.
| Why can't \"r\" find its packages and how do I
| have to change my configuration? 

You probably installed Rmpi somewhere where R knows how to find it, but r
doesn't. So do

~> r -e 'print(.libPaths())'
[1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"       "/usr/lib/R/library"           
~> Rscript -e 'print(.libPaths())'
[1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"       "/usr/lib/R/library"           
~> echo 'print(.libPaths())' | R --slave
[1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"       "/usr/lib/R/library"           
~> 

which on my system are all identical. On yours they may not.

Similarly, you can tell r etc where to load a package from, see
help(library).

Dirk
 
-- 
Three out of two people have difficulties with fractions.



More information about the R-SIG-Debian mailing list