pkgload icon indicating copy to clipboard operation
pkgload copied to clipboard

load_all() fails cryptically for Matrix

Open MichaelChirico opened this issue 10 months ago • 1 comments

I see the following (truncated) output for pkgload::load_all("Matrix") for the package cloned from the cran/Matrix GitHub repo:

─  DONE (Matrix)
Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
In addition: Warning message:
In readChar(con, 5L, useBytes = TRUE) :
  cannot open compressed file '', probable reason 'No such file or directory'

This must be some sort of compilation issue;

  1. Is load_all() expected to work for all (non-default) packages, including recommended priority?
  2. Can this error be improved?

MichaelChirico avatar Apr 25 '24 04:04 MichaelChirico

With options(error=recover), I could track down that it's coming while trying to load data/ objects, specifically:

https://github.com/cran/Matrix/blob/d91a3f2149572d5e4801cb9d4c28d55ffd3642e8/data/CAex.R#L5

It looks like system.file() wound up with the wrong paths, specifically:

list.files(system.file(package='Matrix'))
#  [1] "build"       "cleanup"     "data"        "DESCRIPTION" "inst"       
#  [6] "LICENCE"     "man"         "MD5"         "NAMESPACE"   "po"         
# [11] "R"           "src"         "tests"       "vignettes"  

Looks like we need to further prefix system.file() paths with inst/.

MichaelChirico avatar Apr 25 '24 04:04 MichaelChirico