[R] Can't load package 'lars'

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Dec 6 18:31:56 CET 2011



On 06.12.2011 18:27, Luc Villandre wrote:
> Hello,
>
> I do think so.
>
> ###
> [villandre at stat04 lars]$ pwd
> /home/villandre/R/x86_64-redhat-linux-gnu-library/2.11/lars
> [villandre at stat04 lars]$ ls
> data  DESCRIPTION  help  html  INDEX  libs  Meta  NAMESPACE  R
> ###
>
> I re-installed it and I still get the same error message.
>
> ####
>
>> install.packages("lars", lib = "~/R/x86_64-redhat-linux-gnu-library/2.11")
>
> trying URL 'http://software.rc.fas.harvard.edu/mirrors/R/src/contrib/lars_0.9-8.tar.gz'
> Content type 'application/x-gzip' length 172011 bytes (167 Kb)
> opened URL
> ==================================================
> downloaded 167 Kb
>
> * installing *source* package ‘lars’ ...
> ** libs
> gfortran -m64   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c delcol.f -o delcol.o
> gcc -m64 -std=gnu99 -shared -L/usr/local/lib64 -o lars.so delcol.o -lgfortran -lm -L/usr/lib64/R/lib -lR
> installing to /mnt/prism/s20/villandre/R/x86_64-redhat-linux-gnu-library/2.11/lars/libs
> ** R
> ** data
> ** preparing package for lazy loading
> ** help
> *** installing help indices
>    converting help for package ‘lars’
>      finding HTML links ... done
>      cv.lars                                 html
>      diabetes                                html
>      lars-internal                           html
>      lars                                    html
>      plot.lars                               html
>      predict.lars                            html
>      summary.lars                            html
> ** building package indices ...
> ** testing if installed package can be loaded
> Loaded lars 0.9-8
>
> * DONE (lars)
>
> The downloaded packages are in
>          ‘/tmp/RtmphxCj4j/downloaded_packages’
>> library(lars, lib.loc = "~/R/x86_64-redhat-linux-gnu-library/2.11")
> Error : .onLoad failed in loadNamespace() for 'lars', details:
>    call: cat("Loaded lars", utils::installed.packages()["lars", "Version"],
>    error: subscript out of bounds



I haven't looked closely enough before:

The culprit is in lars which has:

cat("Loaded lars", utils::installed.packages()["lars", "Version"],

and hence only looks at the default search path to report its version 
while you supplied a different one.

Thus, it is a bug in the package you should report to its maintainer.

I the meantime as a workaround (and maybe more convenient anyway): set 
the location of your library using .libPaths() before loading the package.


Uwe Ligges








> Error: package/namespace load failed for ‘lars’
> ####
>
> It is the first time I get such an error message when trying to load a package. It would seem that the problem is with
>
> ###
> cat("Loaded lars", utils::installed.packages()["lars", "Version"]
> ###
>
> Is there a way to circumvent this problem (e.g. attribute an arbitrary value to utils::installed.packages()["lars", "Version"])?
>
> Thanks for your help,
>
> Luc
> ________________________________________
> From: Uwe Ligges [ligges at statistik.tu-dortmund.de]
> Sent: Tuesday, December 06, 2011 8:01 AM
> To: Luc Villandre
> Cc: r-help
> Subject: Re: [R] Can't load package 'lars'
>
> On 06.12.2011 03:33, Luc Villandre wrote:
>> Hi,
>>
>> I installed package 'lars' earlier tonight and did not get any sort of
>> error message.
>>
>> ###
>> ** building package indices ...
>> ** testing if installed package can be loaded
>> Loaded lars 0.9-8
>>
>> * DONE (lars)
>> ###
>>
>> However, when I try to load it, I get
>> ###
>>   >  library(lars, lib.loc = "~/R/x86_64-redhat-linux-gnu-library/2.11")
>
> Are you sure it is installed at the location you specified?
>
> Uwe Ligges
>
>
>
>> Error : .onLoad failed in loadNamespace() for 'lars', details:
>> call: cat("Loaded lars", utils::installed.packages()["lars", "Version"],
>> error: subscript out of bounds
>> Error: package/namespace load failed for ‘lars’
>> ###
>>
>> Session info:
>>
>> ###
>>   >  sessionInfo()
>> R version 2.14.0 (2011-10-31)
>> Platform: x86_64-redhat-linux-gnu (64-bit)
>>
>> locale:
>> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
>> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
>> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
>> [7] LC_PAPER=C LC_NAME=C
>> [9] LC_ADDRESS=C LC_TELEPHONE=C
>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>
>> attached base packages:
>> [1] stats graphics grDevices utils datasets methods base
>>
>> loaded via a namespace (and not attached):
>> [1] rpart_3.1-50 tools_2.14.0
>> ###
>>
>> I get the same error message when I try to load it on another machine:
>>
>> ###
>>
>>   >  library("lars",lib.loc = "~/R/i686-pc-linux-gnu-library/2.12")
>> Error : .onLoad failed in loadNamespace() for 'lars', details:
>> call: cat("Loaded lars", utils::installed.packages()["lars", "Version"],
>> error: subscript out of bounds
>> Error: package/namespace load failed for 'lars'
>> ###
>>
>> Session info:
>>
>> ###
>>   >  sessionInfo()
>> R version 2.13.1 (2011-07-08)
>> Platform: i686-pc-linux-gnu (32-bit)
>>
>> locale:
>> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
>> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
>> [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8
>> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
>> [9] LC_ADDRESS=C LC_TELEPHONE=C
>> [11] LC_MEASUREMENT=en_US.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.13.1
>> ###
>>
>> Is there at least a way to circumvent the problem?
>>
>> Thank you for your help,
>>
>> Luc Villandre
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list