ankane / jetpack

A friendly package manager for R
Other
241 stars 16 forks source link

can't install exact version #19

Closed debuglevel closed 2 years ago

debuglevel commented 4 years ago

I feel like I am really missing something, but I just can't figure out what I'm doing wrong. I'm trying to install an exact version of a package which is not the latest published (knitr@1.27). Installing knitr works fine.

Summarized output:

$ docker run -ti r-base:3.6.2
[...]
install.packages("jetpack")
[...]
jetpack::init()
[...]
jetpack::add("knitr@1.27")
Error: couldn't find package 'knitr'

Full output:

> docker run -ti r-base:3.6.2

R version 3.6.2 (2019-12-12) -- "Dark and Stormy Night"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> install.packages("jetpack")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘backports’, ‘assertthat’, ‘R6’, ‘rprojroot’, ‘packrat’, ‘remotes’, ‘crayon’, ‘desc’

trying URL 'https://cloud.r-project.org/src/contrib/backports_1.1.5.tar.gz'
Content type 'application/x-gzip' length 14798 bytes (14 KB)
==================================================
downloaded 14 KB

trying URL 'https://cloud.r-project.org/src/contrib/assertthat_0.2.1.tar.gz'
Content type 'application/x-gzip' length 12742 bytes (12 KB)
==================================================
downloaded 12 KB

trying URL 'https://cloud.r-project.org/src/contrib/R6_2.4.1.tar.gz'
Content type 'application/x-gzip' length 35536 bytes (34 KB)
==================================================
downloaded 34 KB

trying URL 'https://cloud.r-project.org/src/contrib/rprojroot_1.3-2.tar.gz'
Content type 'application/x-gzip' length 50414 bytes (49 KB)
==================================================
downloaded 49 KB

trying URL 'https://cloud.r-project.org/src/contrib/packrat_0.5.0.tar.gz'
Content type 'application/x-gzip' length 126837 bytes (123 KB)
==================================================
downloaded 123 KB

trying URL 'https://cloud.r-project.org/src/contrib/remotes_2.1.0.tar.gz'
Content type 'application/x-gzip' length 131622 bytes (128 KB)
==================================================
downloaded 128 KB

trying URL 'https://cloud.r-project.org/src/contrib/crayon_1.3.4.tar.gz'
Content type 'application/x-gzip' length 658694 bytes (643 KB)
==================================================
downloaded 643 KB

trying URL 'https://cloud.r-project.org/src/contrib/desc_1.2.0.tar.gz'
Content type 'application/x-gzip' length 65612 bytes (64 KB)
==================================================
downloaded 64 KB

trying URL 'https://cloud.r-project.org/src/contrib/jetpack_0.4.3.tar.gz'
Content type 'application/x-gzip' length 12181 bytes (11 KB)
==================================================
downloaded 11 KB

* installing *source* package ‘backports’ ...
** package ‘backports’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-MP6Q4u/r-base-3.6.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c dotsElt.c -o dotsElt.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-MP6Q4u/r-base-3.6.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c dotsLength.c -o dotsLength.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-MP6Q4u/r-base-3.6.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o backports.so dotsElt.o dotsLength.o init.o -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/00LOCK-backports/00new/backports/libs
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (backports)
* installing *source* package ‘assertthat’ ...
** package ‘assertthat’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** 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 (assertthat)
* installing *source* package ‘R6’ ...
** package ‘R6’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** 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 (R6)
* installing *source* package ‘packrat’ ...
** package ‘packrat’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** 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 (packrat)
* installing *source* package ‘remotes’ ...
** package ‘remotes’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** 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 (remotes)
* installing *source* package ‘crayon’ ...
** package ‘crayon’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** 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 (crayon)
* installing *source* package ‘rprojroot’ ...
** package ‘rprojroot’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** 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 (rprojroot)
* installing *source* package ‘desc’ ...
** package ‘desc’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** 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 (desc)
* installing *source* package ‘jetpack’ ...
** package ‘jetpack’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** 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 (jetpack)

The downloaded source packages are in
        ‘/tmp/Rtmp5npmtv/downloaded_packages’
> jetpack::init()
Creating virtual environment...
Run 'jetpack::add(package)' to add packages!
Warning messages:
1: In untar(src, exdir = target, compressed = "gzip") :
  argument 'compressed' is ignored for the internal method
2: In untar(src, compressed = "gzip", list = TRUE) :
  argument 'compressed' is ignored for the internal method
> jetpack::add("knitr@1.27")
Error: couldn't find package 'knitr'

Would be great if I could get jetpack running; jetpack is just the missing piece in the R environment for a software developer :-)

ankane commented 4 years ago

Hey @debuglevel, unfortunately, I'm not able to reproduce. With the instructions above, I get:

> jetpack::add("knitr@1.27")
Downloading package from url: https://cloud.r-project.org//src/contrib/Archive/knitr/knitr_1.27.tar.gz
Installing 10 packages: evaluate, highr, markdown, stringr, yaml, xfun, mime, glue, magrittr, stringi
Installing packages into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)

# ... lots of output ...

* DONE (knitr)

Adding these packages to packrat:
             _      
    evaluate   0.14 
    glue       1.3.1
    highr      0.8  
    knitr      1.27 
    magrittr   1.5  
    markdown   1.1  
    mime       0.9  
    stringi    1.4.5
    stringr    1.4.0
    xfun       0.12 
    yaml       2.2.1

Installing evaluate (0.14) ... 
    OK (built source)
Installing glue (1.3.1) ... 
    OK (built source)
Installing highr (0.8) ... 
    OK (built source)
Installing magrittr (1.5) ... 
    OK (built source)
Installing mime (0.9) ... 
    OK (built source)
Installing stringi (1.4.5) ... 
    OK (built source)
Installing xfun (0.12) ... 
    OK (built source)
Installing yaml (2.2.1) ... 
    OK (built source)
Installing stringr (1.4.0) ... 
    OK (built source)
Installing markdown (1.1) ... 
    OK (built source)
Installing knitr (1.27) ... 
    OK (built source)
Using evaluate 0.14
Using glue 1.3.1
Using highr 0.8
Using knitr 1.27
Using magrittr 1.5
Using markdown 1.1
Using mime 0.9
Using packrat 0.5.0
Using stringi 1.4.5
Using stringr 1.4.0
Using xfun 0.12
Using yaml 2.2.1
Pack complete!

Maybe you're using a custom CRAN mirror that doesn't have it?

debuglevel commented 4 years ago

Hm.. that's weird. curl https://cloud.r-project.org//src/contrib/Archive/knitr/knitr_1.27.tar.gz works fine in the docker container. So the CRAN mirror should have it.

Any ideas how to debug this issue? Unfortunately I'm not a great R magician :-)

debuglevel commented 4 years ago

I tried it on a Docker container on https://labs.play-with-docker.com/ and again I got that the package could not be found.

The commands to use are basically this, right?

bash$ docker run -ti r-base
R> install.packages("jetpack")
R> jetpack::init()
R> jetpack::add("knitr@1.27")
ankane commented 4 years ago

Yeah, those are the commands. Try setting:

options(internet.info = 0)

Ref: https://github.com/r-lib/remotes/issues/425

ankane commented 4 years ago

I was able to reproduce on https://labs.play-with-docker.com/. However, I'm not sure what the issue is. The only difference in output appears to be the IP address where cloud.r-project.org resolves. I thought the archive files might be different, but they have the same size and hash.

download.file("https://cloud.r-project.org//src/contrib/Meta/archive.rds", "archive.rds")
file.size("archive.rds")
# [1] 2504129
tools::md5sum("archive.rds")
# "96f81f58684bc81ec2e0d23e3d273a84"

Downloading the files works for both as well.

download.file("https://cloud.r-project.org//src/contrib/Archive/knitr/knitr_1.27.tar.gz", "knitr_1.27.tar.gz")
ankane commented 2 years ago

Cleaning up stale issues. If anyone else runs into this, feel free to create a new issue.