r-lib / pak

A fresh approach to package installation
https://pak.r-lib.org
643 stars 56 forks source link

is not a valid R package, it is an empty archive #518

Closed royfrancis closed 1 year ago

royfrancis commented 1 year ago

Getting this error with some packages. As an example;

>> pak::pkg_install("patchwork")

→ Will install 1 package.
→ Will download 1 CRAN package (3.19 MB).
+ patchwork   1.1.2 [bld][dl] (3.19 MB)
ℹ Getting 1 pkg (3.19 MB)
✔ Got patchwork 1.1.2 (source) (3.19 MB)                               
✔ Downloaded 1 package (3.19 MB)in 946ms                               
ℹ Building patchwork 1.1.2
✔ Built patchwork 1.1.2 (4.1s)                                       
Error:                                                                 
! error in pak subprocess
Caused by error in `verify_extracted_package(filename, pkg_cache)`:
! '/tmp/Rtmp7LxpdS/file95fd9c3dbb/patchwork_1.1.2_R_x86_64-pc-linux-gnu.tar.gz' is not a valid R package, it is an empty archive

It works with install.packages().

>> install.packages("patchwork")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/patchwork_1.1.2.tar.gz'
Content type 'application/x-gzip' length 3192018 bytes (3.0 MB)
==================================================
downloaded 3.0 MB

* installing *source* package ‘patchwork’ ...
** package ‘patchwork’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location

** testing if installed package keeps a record of temporary installation path
* DONE (patchwork)

The downloaded source packages are in
    ‘/tmp/RtmpnFKcDc/downloaded_packages’
>> sessionInfo()
R version 4.2.3 (2023-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so

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=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  
[7] base     

loaded via a namespace (and not attached):
 [1] prettyunits_1.1.1 pak_0.5.1         ps_1.7.5         
 [4] crayon_1.5.2      rprojroot_2.0.3   pkgdepends_0.5.0 
 [7] R6_2.5.1          jsonlite_1.8.4    zip_2.3.0        
[10] cli_3.6.1         rstudioapi_0.14   callr_3.7.3      
[13] filelock_1.0.2    desc_1.4.2        tools_4.2.3      
[16] glue_1.6.2        compiler_4.2.3    processx_3.8.1   
[19] pkgbuild_1.4.0    lpSolve_5.6.18  

>> options("repos")
$repos
                                                    CRAN 
                          "https://cloud.r-project.org/" 
                                                BioCsoft 
           "https://bioconductor.org/packages/3.16/bioc" 
                                                 BioCann 
"https://bioconductor.org/packages/3.16/data/annotation" 
                                                 BioCexp 
"https://bioconductor.org/packages/3.16/data/experiment" 
                                               CRANextra 
                   "https://www.stats.ox.ac.uk/pub/RWin" 

Running in RStudio Server in a docker container.

RStudio Server 2023.03.0 Build 386

gaborcsardi commented 1 year ago

Are you sure that you are not running out of disk space?

royfrancis commented 1 year ago

As far as I can see, there is plenty of disk space. Even if it was the disk space, the regular install.packages() command works immediately after.

gaborcsardi commented 1 year ago

Pak uses more disk space because it has a cache and it creates a binary package first.

royfrancis commented 1 year ago

It's a new laptop and there is more than a TB of space. I am hoping the docker container I am running has access to all that. I haven't defined any restrictions.

gaborcsardi commented 1 year ago

What OS do you have on the host? Ie on the laptop itself?

royfrancis commented 1 year ago

It's a MacBook Pro M2.

aarch64-apple-darwin20.0.0 (64-bit)
macOS Ventura 13.4.1
gaborcsardi commented 1 year ago

Then Docket does not have access to that space. You can see the amount of empty space and you can also make it bigger in the Docker dashboard. And/or you can run 'docker system prune' to remove unused images and containers.

If this does not work then can you please share your Dockerfile?

royfrancis commented 1 year ago

Interesting! So, I looked into disk usage and it was by default set to 64GB. But only 43GB of 64GB was used. So, it probably shouldn't be limiting. Anyhow, I increased it to 200GB. Restarted docker and the container and tried the installation again. Same error! I will put together a Dockerfile that I can share.

royfrancis commented 1 year ago

Tried again with a new Dockerfile, image and container and it works!

gaborcsardi commented 1 year ago

It would be good to know why the first file didn't work. Do you think you can share that?