pak
pak copied to clipboard
Error: 'C:\\Users.../data.table_1.14.0.zip' is not a valid R package, it is an empty archive
Hello, I just started using R on a server at work, and I tried to install packages with pak
but I always get the same error, whatever the package. Here, with data.table
for instance:
> pak::pkg_install(c("data.table"))
v Loading metadata database ... done
> Will install 1 package.
> Will download 1 CRAN package (2.60 MB).
+ data.table 1.14.0 [dl] (2.60 MB)
i Getting 1 pkg (2.60 MB)
v Cached copy of data.table 1.14.0 (windows) is the latest build
v No downloads needed, all packages are cached
Erreur : 'C:\\Users\\etienne\\AppData\\Local\\Temp\\37\\Rtmp67Ykij\\file171c13c23b9f/bin/windows/contrib/4.1/data.table_1.14.0.zip' is not a valid R package, it is an empty archive
Type .Last.error.trace to see where the error occurred
I only get this with pak
. If I use install.packages("data.table")
, everything works fine. I am using GitHub version (‘0.1.2.9001’
). I tried to manually clear C:\\Users\\etienne\\AppData\\Local\\Temp\\37
but it doesn't change anything.
Session info
R version 4.1.0 (2021-05-18) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows Server x64 (build 17763)Matrix products: default
locale: [1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252
[3] LC_MONETARY=French_France.1252 LC_NUMERIC=C
[5] LC_TIME=French_France.1252attached base packages: [1] stats graphics grDevices utils datasets methods
[7] baseloaded via a namespace (and not attached): [1] processx_3.5.2 compiler_4.1.0 R6_2.5.0
[4] cli_3.0.0 tools_4.1.0 glue_1.4.2
[7] data.table_1.14.0 callr_3.7.0 ps_1.6.0
[10] pak_0.1.2.9001
I am sorry for the slow response. Do you still have this issue?
Hello, thank you for coming back to this issue. I still have the same problem, here's the output of .Last.error.trace
:
> .Last.error.trace
Stack trace:
12. (function (...) ...
13. base:::withCallingHandlers(cli_message = function(msg) { ...
14. get("pkg_install_do_plan", asNamespace("pak"))(...)
15. pkgdepends::install_package_plan(plan = plan, lib = lib, num_ ...
16. base:::withCallingHandlers({ ...
17. pkgdepends:::handle_events(state, events)
18. pkgdepends:::handle_event(state, i)
19. proc$get_result()
20. processx:::process_get_result(self, private)
21. private$post_process()
22. pkgdepends:::install_extracted_binary(filename, lib_cache, pk ...
23. pkgdepends:::verify_extracted_package(filename, pkg_cache)
24. base:::throw(new_input_error("{filename} is not a valid R pac ...
25. base:::signalCondition(cond)
26. (function (e) ...
27. base:::stop(e)
28. (function (e) ...
x 'C:\\Users\\etienne\\AppData\\Local\\Temp\\300\\RtmpaAiexJ\\file68dc6538560/bin/windows/contrib/4.1/data.table_1.14.2.zip' is not a valid R package, it is an empty archive
I checked the zip file indicated in the error message, it is not empty.
How did you install pak? Can you try the devel version? You can install it like this:
install.packages("pak", repos = "https://r-lib.github.io/p/pak/devel")
Also, what's the output of
getOption("repos")
pak::repo_get()
Reinstalled pak as you indicated, same error. Also tried to install data.table after deleting pak cache, but same error.
Here are the outputs you asked:
> getOption("repos")
CRAN
"https://cran.rstudio.com/"
attr(,"RStudio")
[1] TRUE
> pak::repo_get()
# A tibble: 5 x 5
name url type r_version bioc_version
<chr> <chr> <chr> <chr> <chr>
1 CRAN https://cran.rstudio.com/ cran * NA
2 BioCsoft https://bioconductor.org/packa~ bioc 4.1.1 3.14
3 BioCann https://bioconductor.org/packa~ bioc 4.1.1 3.14
4 BioCexp https://bioconductor.org/packa~ bioc 4.1.1 3.14
5 BioCworkflows https://bioconductor.org/packa~ bioc 4.1.1 3.14
Can you please try a simple source package?
pak::pkg_install("pkgconfig?source")
Can you also try to run these?
system2(system.file(package = "pak", "library", "zip", "bin", "x64", "zip.exe"), "--help")
system2(system.file(package = "pak", "library", "zip", "bin", "x64", "cmdunzip.exe"))
Thanks!
> pak::pkg_install("pkgconfig?source")
> Will install 1 package.
> Will download 1 CRAN package (6.08 kB).
+ pkgconfig 2.0.3 [bld][dl] (6.08 kB)
! pkgconfig is loaded in the current R session, you probably need to restart R
after the installation.
i Getting 1 pkg (6.08 kB)
v Got pkgconfig 2.0.3 (source) (6.08 kB)
v Downloaded 1 package (6.08 kB)in 494ms
i Building pkgconfig 2.0.3
v Built pkgconfig 2.0.3 (6.9s)
Erreur : 'C:\\Users\\etienne\\AppData\\Local\\Temp\\300\\RtmpURDvy9\\file69845cd73a29/pkgconfig_2.0.3.zip' is not a valid R package, it is an empty archive
Type .Last.error.trace to see where the error occurred
> system2(system.file(package = "pak", "library", "zip", "bin", "x64", "zip.exe"), "--help")
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
Zip 3.0 (July 5th 2008). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
The default action is to add or replace zipfile entries from list, which
can include the special name - to compress standard input.
If zipfile and list are omitted, zip compresses stdin to stdout.
-f freshen: only changed files -u update: only changed or new files
-d delete entries in zipfile -m move into zipfile (delete OS files)
-r recurse into directories -j junk (don't record) directory names
-0 store only -l convert LF to CR LF (-ll CR LF to LF)
-1 compress faster -9 compress better
-q quiet operation -v verbose operation/print version info
-c add one-line comments -z add zipfile comment
-@ read names from stdin -o make zipfile as old as latest entry
-x exclude the following names -i include only the following names
-F fix zipfile (-FF try harder) -D do not add directory entries
-A adjust self-extracting exe -J junk zipfile prefix (unzipsfx)
-T test zipfile integrity -X eXclude eXtra file attributes
-! use privileges (if granted) to obtain all aspects of WinNT security
-$ include volume label -S include system and hidden files
-e encrypt -n don't compress these suffixes
-h2 show more help
> system2(system.file(package = "pak", "library", "zip", "bin", "x64", "cmdunzip.exe"))
Usage: \\crc\users\etienne\My Documents\R\R-4.1.1\library\pak\library\zip\bin\x64\cmdunzip.exe zip-file target-dir
One more shot in the dark:
Sys.which("zip")
Sys.which("unzip")
> Sys.which("zip")
zip
""
> Sys.which("unzip")
unzip
""
Is it helpful?
I am sorry, I have no clue what is going on. What is your exact OS? Do you have rtools40 installed?
I'm using Windows Server 2016 Standard, v. 1607, build 14393.4704. rtools40 is installed.
It's not so important, pak::pkg_install
doesn't work but install.packages
does so I'm not completely blocked. Thanks for your help anyway. I don't know if I should let this issue open since it isn't solved, so I'll let you close it if necessary
I would like to understand what is happening here, so thank you for the help! I'll send you a couple of more commands to run soon, if you don't mind.
In case this is useful - I encountered the same "empty archive" error message just now. I had specified lib
with a path to a directory, but I didn't have write permissions on that directory.
After granting write permissions on that directory, pkg_install()
worked without issue 😇
I am getting a similar error in a workflow, here for installing brio: https://github.com/cynkra/cynkrablog/actions/runs/6770789485/job/18399890155?pr=23#step:4:1151 but before that the error was on base64enc installation.
I come back to this issue thanks to @maelle's comment. After updating pak
, I don't see this issue anymore. I can't tell if this is due to the upgrade or a change on the server I'm using but in any case this is resolved for me.
@maelle Your default package library is not writeable.
thank you, but what I don't get is why, I haven't tweaked anything I know of. :thinking:
There is nothing to tweak, on GHA there is no user package library by default, and the site and system libraries are not writeable for the default user. AFAICT.
We should certainly give a better error message, possibly check that the library is writeable before starting the installation.
Ok, so I'll look into the r-lib/actions examples to see where I need to set the package library. Thank you!!
Those examples use r-lib/actions/setup-r
which configures a writeable library for you. So there is no need to do anything in the examples there.
How embarrassing is it that my workflow didn't have the R setup step :woman_facepalming: Thanks so much!
Well, GHA machines have R installed, so if that version is OK, you don't to install another one. But then you need to do
dir.create(Sys.getenv("R_LIBS_USER"), recursive = TRUE)
or something like that, first.
Closing since it looks like @maelle fixed her issue