devtools::install_github("hadley/devtools") failure

Created on 30 Sep 2015  Â·  15Comments  Â·  Source: r-lib/devtools

Hi Hadley

I'm reading your book “R packages”, but unfortunately got stuck at the Getting Started section with the
devtools::install_github("hadley/devtools") line.

I've installed the packages:
install.packages(c("devtools", "roxygen2", "testthat", "knitr"))

I've got the RStudio API:

rstudioapi::isAvailable("0.99.149")
[1] TRUE

But, when I run the following:
devtools::install_github("hadley/devtools")

I get this:

devtools::install_github("hadley/devtools")
Downloading github repo hadley/devtools@master
Installing devtools
"C:/PROGRA~1/RRO/R-32~1.2/bin/x64/R" --no-site-file --no-environ --no-save --no-restore CMD INSTALL \
"C:/Users/Rvermaak/AppData/Local/Temp/Rtmpwnsawu/devtools2e2455761c23/hadley-devtools-81dd313" \
--library="C:/Users/Rvermaak/Documents/R/win-library/3.2" --install-tests

  • installing _source_ package 'devtools' ...
    * libs
    gcc -m64 -I"C:/PROGRA~1/RRO/R-32~1.2/include" -DNDEBUG -I"c:/applications/extsoft/include" -O2 -Wall -std=gnu99 -mtune=core2 -c devtools.c -o devtools.o
    gcc -m64 -shared -s -static-libgcc -o devtools.dll tmp.def devtools.o -Lc:/applications/extsoft/lib/x64 -Lc:/applications/extsoft/lib -LC:/PROGRA~1/RRO/R-32~1.2/bin/x64 -lR
    installing to C:/Users/Rvermaak/Documents/R/win-library/3.2/devtools/libs/x64
    Warning in file.copy(files, dest, overwrite = TRUE) :
    problem copying .\devtools.dll to C:\Users\Rvermaak\Documents\R\win-library\3.2\devtools\libsx64\devtools.dll: Permission denied
    ** R
    ** inst
    ** tests
    ** preparing package for lazy loading
    ** help
    *
    * installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
  • DONE (devtools)

(NOTE: There is a file copy warning, but it seems to have installed fine?)

When I try to subsequently load the library, things go a bit pear-shaped:

library(devtools)
Error in get(method, envir = home) :
lazy-load database 'C:/Users/Rvermaak/Documents/R/win-library/3.2/devtools/R/devtools.rdb' is corrupt
In addition: Warning message:
In get(method, envir = home) : internal error -3 in R_decompress1
Error: package or namespace load failed for ‘devtools’

I've tried re-installing a few times, but I'm out of ideas. Please advise?

Thank you in advance

Most helpful comment

Whenever you see "lazy-load database corrupted", the first thing to try is restarting R.

All 15 comments

Maybe a corrputed previous installation?
Try manually removing the whole dir
|C:/Users/Rvermaak/Documents/R/win-library/3.2/devtools/|
and reinstall

ƒacu.-

On 09/30/2015 10:54 AM, csrvermaak wrote:

Hi Hadley

I'm reading your book “R packages”, but unfortunately got stuck at the
Getting Started section with the
devtools::install_github("hadley/devtools") line.

I've installed the packages:
install.packages(c("devtools", "roxygen2", "testthat", "knitr"))

I've got the RStudio API:

rstudioapi::isAvailable("0.99.149")
[1] TRUE

But, when I run the following:
devtools::install_github("hadley/devtools")

I get this:

devtools::install_github("hadley/devtools")
Downloading github repo hadley/devtools@master
Installing devtools
"C:/PROGRA~1/RRO/R-32~1.2/bin/x64/R" --no-site-file --no-environ
--no-save --no-restore CMD INSTALL \
"C:/Users/Rvermaak/AppData/Local/Temp/Rtmpwnsawu/devtools2e2455761c23/hadley-devtools-81dd313"
\
--library="C:/Users/Rvermaak/Documents/R/win-library/3.2"
--install-tests
  • installing /source/ package 'devtools' ... * libs gcc -m64
    -I"C:/PROGRA~1/RRO/R-32~1.2/include" -DNDEBUG
    -I"c:/applications/extsoft/include" -O2 -Wall -std=gnu99
    -mtune=core2 -c devtools.c -o devtools.o gcc -m64 -shared -s
    -static-libgcc -o devtools.dll tmp.def devtools.o
    -Lc:/applications/extsoft/lib/x64 -Lc:/applications/extsoft/lib
    -LC:/PROGRA~1/RRO/R-32~1.2/bin/x64 -lR installing to
    C:/Users/Rvermaak/Documents/R/win-library/3.2/devtools/libs/x64
    Warning in file.copy(files, dest, overwrite = TRUE) : problem
    copying .\devtools.dll to
    C:\Users\Rvermaak\Documents\R\win-library\3.2\devtools\libsx64\devtools.dll:
    Permission denied ** R ** inst ** tests ** preparing package for
    lazy loading ** help *
    * installing help indices ** building
    package indices ** installing vignettes ** testing if installed
    package can be loaded
  • DONE (devtools)

(NOTE: There is a file copy warning, but it seems to have installed fine?)

When I try to subsequently load the library, things go a bit pear-shaped:

library(devtools)
Error in get(method, envir = home) :
lazy-load database
'C:/Users/Rvermaak/Documents/R/win-library/3.2/devtools/R/devtools.rdb'
is corrupt
In addition: Warning message:
In get(method, envir = home) : internal error -3 in R_decompress1
Error: package or namespace load failed for ‘devtools’

I've tried re-installing a few times, but I'm out of ideas. Please
advise?

Thank you in advance

—
Reply to this email directly or view it on GitHub
https://github.com/hadley/devtools/issues/942.

​

Signature electronique
INRA http://www.inra.fr

_Facundo MUÑOZ_
_Postdoctoral Statistician_
facundo.[email protected] mailto:[email protected]
_Institut National de la Recherche Agronomique - Centre Val de Loire
Unité Amélioration, Génétique et Physiologie ForestiÚres_
TĂšl. : +33 (0)2 38 41 78 14
Fax : +33 (0)2 38 41 78 79

2163 Avenue de la Pomme de Pin
CS 40001 ARDON, 45075 ORLEANS Cedex 02
France
www.inra.fr http://www.inra.fr

Hi famuvie

Thanks for the great suggestion, I tried it, but it unfortunately didn't work.

Do you have Rtools installed?

I just installed it, unfortunately no luck. Thanks for the suggestion, will keep plugging at it

Step way back. Maybe consult the RStudio documentation on building R packages and many of their other documentation entries. The RStudio IDE checks for matching RTools etc pp.

In essence, you never built an R package, and need to work through this. It is documented in many places, please do not expect us to repeat it all for you here.

I suggest @hadley closes this. There is no devtools issue.

100% - will do that

Actually, I think you as OP could close this too. Please do.

Whenever you see "lazy-load database corrupted", the first thing to try is restarting R.

Everytime I get this message it means I have re-installed a package that is loaded in my current R session. So then I restart (like Hadley says) and it loads cleanly in the new session. I think this practically happens by definition whenever you install devtools from github?

That's why some of us install packages from the command-line. Littler is still your friend. Never had this issue. (Note that OP is off the island anyway as he uses Windows which famously has all sorts of other issues.)

Oh, and @jennybc I don't think install_github() has anything to do with it. At the end of the day it still calls install.packages() on a tarballs just like the Founding Fathers intended. It just uses a non-standard way of getting that tarball...

This error is actually entirely unrelated to devtools and can be reproduced from a fresh R --vanilla session.

options(repos = c(CRAN = "http://cran.rstudio.com"))
install.packages("ggplot2")
#> Updating HTML index of packages in '.Library'
#> Making 'packages.html' ... done
library("ggplot2")
install.packages("ggplot2")
#> Updating HTML index of packages in '.Library'
#> Making 'packages.html' ... done
unloadNamespace("ggplot2")
library("ggplot2")
#> Warning in get(method, envir = home): internal error -3 in R_decompress1
#> Error: package or namespace load failed for 'ggplot2'

It seems there is a bug in properly closing/freeing the lazy-load database when unloadNamespace() is called. So then when you install the new package over top of the old one the database files are changed on disk and you get the internal error. unloadNamespace() calls lazyLoadDBflush() which should remove the reference to the database file. This alone must not be sufficient for this use case however...

You can unloadNamespace() a package and then re-attach it with library() or require() as many times as you like as long as as long as you don't try overwrite the existing files.

You can also install the library to a different location then load it without error.

options(repos = c(CRAN = "http://cran.rstudio.com"))
install.packages("ggplot2")
#> Updating HTML index of packages in '.Library'
#> Making 'packages.html' ... done
library("ggplot2")
install.packages("ggplot2", lib = tempdir())
unloadNamespace("ggplot2")
library("ggplot2", lib.loc = tempdir())

It is only when you install a package over top the already loaded one, then unload and try to reload that it causes an error.

That's why some of us install packages from the command-line.

-- Me, on Sep 30

This command worked for me on RGUi (not on Rstudio):

install_github("hadley/devtools",force = TRUE)

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hadley picture hadley  Â·  3Comments

ctbrown picture ctbrown  Â·  4Comments

lindbrook picture lindbrook  Â·  4Comments

kamapu picture kamapu  Â·  6Comments

bastistician picture bastistician  Â·  6Comments