trinker / pacman

A package management tools for R
311 stars 37 forks source link

error in readRDS on R 3.4.0 #90

Closed arbelt closed 7 years ago

arbelt commented 7 years ago

Not entirely sure what the issue is, but I recently upgraded R to 3.4.0 and ever since pacman seems to be causing issues. If I p_load or p_install a package not already installed, I end up with an error message about readRDS:

Error in readRDS(dest) : error reading from connection

install.packages at this point will return the same error. However, if I restart R and do not load pacman then install.packages works just fine...

Dasonk commented 7 years ago

Yikes. Seems like a serious issue. Just to make sure I have the details correct... are you attempting to install a package you don't currently have and are trying to install from CRAN? And can you give the output from sessionInfo()? Thanks.

Dasonk commented 7 years ago

I can't reproduce the issue on Windows 10. Can you give the output from sessionInfo() and what package you were trying to install?

Dasonk commented 7 years ago

@trinker I was able to reproduce the issue sporadically. I think the easter egg needs to go.

arbelt commented 7 years ago

Here's sessionInfo(). My .Rprofile is pretty minimal, just a require(utils) and a snippet for pacman. It's been sporadic, but it seems to "trigger" most often when I p_load something that's not installed, and once it appears later calls to install.package show the same error.

R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.4

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices datasets  utils     base     

other attached packages:
[1] lintr_1.0.0  pacman_0.4.4

loaded via a namespace (and not attached):
[1] compiler_3.4.0 lazyeval_0.2.0 magrittr_1.5   rex_1.1.1     
Dasonk commented 7 years ago

I think commit c8893181efac851058377efa8fc28a0b189809d7 should fix the issue. Can you install the latest version via devtools::install_github("trinker/pacman") and report back on if the issue seems to be fixed?

arbelt commented 7 years ago

No go... just tried with p_load(plotly):

Installing package into ‘/Users/azw803/Library/R/3.4/library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘viridisLite’, ‘hexbin’, ‘crosstalk’

Error in readRDS(dest) : error reading from connection
arbelt commented 7 years ago

So I tracked down the issue: install.packages emits a warning when PACKAGES.rds is not found on the CRAN repo:

Warning in install.packages :
  cannot open URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.4/PACKAGES.rds': HTTP status was '404 Not Found'

install.packages installs just fine after that, but p_install is catching the warning and passing off to BioC. I'm still a bit concerned that a failed p_install seems to cause future install.packages to fail though.

Made a simple PR #91 that fixes this particular issue, but it is admittedly without reading much of the package code, so perhaps something more needs to be done.

EDIT: Okay, I realized install.packages doesn't throw an error when it doesn't find a packages, so that PR isn't really a fix and more of a BioC bypasser at the moment...

arbelt commented 7 years ago

Okay, I think this is figured out... updated #91 and added a longer note there. Short version: catching the warning prevented cleanup in available.packages from happening, leaving an invalid "cache". This probably should be handled in available.packages, but isn't. So I modified the code a bit not to unwind the stack and let install.packages finish before trying BioC.