Git Product home page Git Product logo

pak's Introduction

pak

A Fresh Approach to R Package Installation

lifecycle CRAN RStudio mirror downloads Codecov test coverage R-CMD-check

pak installs R packages from CRAN, Bioconductor, GitHub, URLs, git repositories, local files and directories. It is an alternative to install.packages() and devtools::install_github(). pak is fast, safe and convenient.

🚀 Short tour

Install or update packages from CRAN or Bioconductor

pak::pkg_install("tibble")
#>  Loading metadata database ... done                                            
#>                                                                                 
#> → Will install 11 packages.                                                     
#> → All 11 packages (7.48 MB) are cached.                                         
#> + cli         3.4.1                                                             
#> + fansi       1.0.3                                                             
#> + glue        1.6.2                                                             
#> + lifecycle   1.0.3                                                             
#> + magrittr    2.0.3                                                             
#> + pillar      1.8.1                                                             
#> + pkgconfig   2.0.3                                                             
#> + rlang       1.0.6                                                             
#> + tibble      3.1.8                                                             
#> + utf8        1.2.2                                                             
#> + vctrs       0.5.1                                                             
#>  No downloads are needed, 11 pkgs (7.48 MB) are cached                         
#>  Installed cli 3.4.1  (68ms)                                                   
#>  Installed fansi 1.0.3  (78ms)                                                 
#>  Installed glue 1.6.2  (95ms)                                                  
#>  Installed lifecycle 1.0.3  (120ms)                                            
#>  Installed magrittr 2.0.3  (126ms)                                             
#>  Installed pkgconfig 2.0.3  (125ms)                                            
#>  Installed pillar 1.8.1  (154ms)                                               
#>  Installed rlang 1.0.6  (176ms)                                                
#>  Installed tibble 3.1.8  (77ms)                                                
#>  Installed utf8 1.2.2  (44ms)                                                  
#>  Installed vctrs 0.5.1  (35ms)                                                 
#>  1 pkg + 10 deps: added 11 [2.8s]                                              

Install packages from GitHub

pak::pkg_install("tidyverse/tibble")
#>                                                                                 
#> → Will update 2 packages.                                                       
#> → All 2 packages (0 B) are cached.                                              
#> + tibble 3.1.8 → 3.1.8.9002 👷🏾🔧 (GitHub: 37ec86a)                               
#> + vctrs  0.5.1 → 0.5.1.9000 👷🏼‍♂️🔧 (GitHub: 48794fd)                            
#>  No downloads are needed, 2 pkgs are cached                                    
#>  Packaging vctrs 0.5.1.9000                                                    
#>  Packaged vctrs 0.5.1.9000 (1.5s)                                              
#>  Building vctrs 0.5.1.9000                                                     
#>  Built vctrs 0.5.1.9000 (11s)                                                  
#>  Installed vctrs 0.5.1.9000 (github::r-lib/vctrs@48794fd) (36ms)               
#>  Packaging tibble 3.1.8.9002                                                   
#>  Packaged tibble 3.1.8.9002 (525ms)                                            
#>  Building tibble 3.1.8.9002                                                    
#>  Built tibble 3.1.8.9002 (3.1s)                                                
#>  Installed tibble 3.1.8.9002 (github::tidyverse/tibble@37ec86a) (34ms)         
#>  1 pkg + 10 deps: kept 9, upd 2 [18.9s]                                        

Look up dependencies

pak::pkg_deps_tree("tibble")
#> tibble 3.1.8                                                                   
#> ├─fansi 1.0.3                                                                  
#> ├─lifecycle 1.0.3                                                              
#> │ ├─cli 3.4.1                                                                  
#> │ ├─glue 1.6.2                                                                 
#> │ └─rlang 1.0.6                                                                
#> ├─magrittr 2.0.3                                                               
#> ├─pillar 1.8.1                                                                 
#> │ ├─cli                                                                         
#> │ ├─fansi                                                                       
#> │ ├─glue                                                                        
#> │ ├─lifecycle                                                                   
#> │ ├─rlang                                                                       
#> │ ├─utf8 1.2.2                                                                 
#> │ └─vctrs 0.5.1                                                                
#> │   ├─cli                                                                       
#> │   ├─glue                                                                      
#> │   ├─lifecycle                                                                 
#> │   └─rlang                                                                     
#> ├─pkgconfig 2.0.3                                                              
#> ├─rlang                                                                         
#> └─vctrs                                                                         
#>                                                                                 
#> Key:   new                                                                     

Explain dependencies

pak::pkg_deps_explain("tibble", "rlang")
#> tibble -> lifecycle -> rlang                                                    
#> tibble -> pillar -> lifecycle -> rlang                                          
#> tibble -> pillar -> rlang                                                       
#> tibble -> pillar -> vctrs -> lifecycle -> rlang                                 
#> tibble -> pillar -> vctrs -> rlang                                              
#> tibble -> rlang                                                                 
#> tibble -> vctrs -> lifecycle -> rlang                                           
#> tibble -> vctrs -> rlang                                                        

Install a local package and its dependencies

pak::local_install("cli")
#>                                                                                 
#> → Will update 1 package.                                                        
#> → The package (0 B) is cached.                                                  
#> + cli 3.4.1 → 3.4.1 👷🏿🔧                                                         
#>  No downloads are needed, 1 pkg is cached                                      
#>  Got cli 3.4.1 (source) (96 B)                                                 
#>  Packaging cli 3.4.1                                                           
#>  Packaged cli 3.4.1 (664ms)                                                    
#>  Building cli 3.4.1                                                            
#>  Built cli 3.4.1 (5s)                                                          
#>  Installed cli 3.4.1 (local) (42ms)                                            
#>  1 pkg: upd 1, dld 1 (NA B) [6.4s]                                             

🔗 Quick links (start here if in doubt!)

How do I … ?

Start at Get Started with pak to solve specific issues.

FAQ

Check out the list of frequently asked questions.

Reference

The complete reference of pak functions is the most complete source of information about pak.

I have a(nother) question

Don’t hesitate to ask at the RStudio Community forum. Use the pak tag.

I would like to report a bug

Head to the pak issue tracker.

✨ Features

⚡ Fast - parallel downloads and installation, caching, etc.

🦺 Safe - dependency solver, system dependency solver, etc.

🏪 Convenient - packages from multiple sources, time travel, etc.

See the complete list of awesome features.

⬇️ Installation

Pre-built binaries

Install a binary build of pak from our repository on GitHub:

install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch))

This is supported for the following systems:

OS CPU R version
Linux x86_64 R 3.5.0 - R-devel
Linux aarch64 R 3.5.0 - R-devel
macOS High Sierra+ x86_64 R 3.5.0 - R-devel
macOS Big Sur+ aarch64 R 4.1.0 - R-devel
Windows x86_64 R 3.5.0 - R-devel

For macOS we only support the official CRAN R build. Other builds, e.g. Homebrew R, are not supported.

Install from CRAN

Install the released version of the package from CRAN as usual:

install.packages("pak")

This potentially needs a C compiler on platforms CRAN does not have binaries packages for.

Other platforms and nightly builds

See the installation page!

📘 License

GPL-3 © RStudio

pak's People

Contributors

andreranza avatar arcresu avatar brendes avatar cderv avatar dpastoor avatar dpprdan avatar gaborcsardi avatar hadley avatar jennybc avatar jimhester avatar krlmlr avatar maelle avatar maxheld83 avatar mine-cetinkaya-rundel avatar mishacivey avatar moohan avatar nealrichardson avatar olivroy avatar pedrobtz avatar qulogic avatar remlapmot avatar riccardoporreca avatar rstub avatar salim-b avatar tanho63 avatar tmstauss avatar tylerlittlefield avatar vincentguyader avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pak's Issues

Self-update

Making pkgman::pkg_install("r-lib/pkgman") is going to be hard, but in the short-term, we might want to special case the install so that you get something like this:

pkgman::pkg_install("r-lib/pkgman")
#> Error: It's not currently possible to use pkgman to update itself
#> Instead, use devtools::install_github("r-lib/pkgman")

Helper for migrating pkgs across R versions

This has been a question a number of different times, some I can recall are @jennybc's workshop at RStudio::conf, @OmaymaS on twitter (https://twitter.com/OmaymaS_/status/1004468608028807170) and elsewhere.

The general consensus is that typically people take the time to re-build their library from scratch, but this is somewhat painful in practice.

Copying packages directly across R versions is problematic, and enumerating across all R packages in the old library is both tricky (due to GH packages + recommended packages) and often overkill.

One potentially useful way to do this would be to copy only packages which had an OS access time less than a cutoff (maybe 30 days by default), which would let you copy all packages that have been recently in use. We could use the RemoteSHA information in the DESCRIPTION to retrieve GH packages as needed.

This would let you fairly easily re-build the useful set of packages from an old library with one call, and take away a lot of the pain when upgrading to a new R version.

Helpers for R version

They’re not a perfect match for this package, but the base functions are painfully inconsistent and clearly rightly related to package installs.

Behavior when Remotes are not also listed in other dependencies

Not entirely sure what the current behavior in pkgdepends is for this, but in devtools if you don't have the Remotes also listed in one of the other fields it is silently skipped.

I now think we may want to either install them regardless or throw an error in this case, but silently ignoring them just leads to confusion.

Source installs sometimes prompt about vignettes

> pkgman::pkg_install("cran/haven")
  Updating CRAN metadata                                                                                                      
✔ CRAN metadata current                                                                                                       
✔ Found 26 dependencies for 1 packages in 864ms                                                                               
  Downloading packages [1/1] [236.53 kB] 00:00:00Building the package will delete...                                          
  '/private/tmp/RtmpyGVI7h/file616a53bf3a99/cran-haven-3d4f402/inst/doc'
Are you sure?

1: Yes
2: No

Two problems:

  • Shouldn't need to build from source
  • When building from source, shouldn't try to rebuild vignettes

lib_ functions

  • lib_create()

  • lib_status()

  • lib_activate() # wrappers around .libPaths()

  • lib_deactivate()

  • lib_temporary() # create an active session specific temporary library

  • lib_upgrade() # should go into different dir?

  • lib_check() # ensure in a consistent/self-contained state (i.e. all deps installed, all for same platform, r version etc)
    (When operating in project-library mode, any install should warn if you make the library inconsistent)

  • lib_record() # record all versions of packages in a suitable way to transmit to someone else. Should also record R version.

  • lib_replay() # install all packages from recording

Motivation bullet points for homepage

Something like this:

  • Much faster: parallel dependency resolution + downloads
  • Cached: only download packages that you haven't already
  • Better output: easily track progress and see when one package has failed
  • Multiple sources: cran + archive + bioc + github are built-in; but also has pluggable backend

Suboptimal github error message

> pkg_install("klutometis/roxygen2")
  Updating CRAN metadata                                                                                     
✔ Updated CRAN metadata                                                                                      
✔ Found 22 dependencies for 1 packages in 4.6s                                                               
 Show Traceback
 
 Rerun with Debug
 Error: Cannot install packages:
  * Cannot install package `roxygen2`.
  - `installed::/Users/hadley/R/roxygen2`, conflicts with `klutometis/roxygen2`
  - failed to resolve ref `klutometis/roxygen2` 

The second error is correct; the first is incorrect/not useful

Support for project package libraries

Project library mode can be turned on via an option. (options?)

ROOT is the root directory of the current project. In general ROOT/r-pkgs is used as the default package library. The dependencies in ROOT/DESCRIPTION is used as the list of packages to install/update/etc.

pkg_install:

  • if called without arguments, it uses the local DESCRIPTION file to get the set of desired packages.
  • if called with one or more packages, it installs them to the local library, and (by default) also adds them to the local DESCRIPTION file.
  • it should be able to remove superfluous packages from the package library.
  • it errors if DESCRIPTION is not present.
  • it creates r-pkgs if it does not exist.

pkg_status:

  • show project library data by default

pkg_remove:

  • removes package from the project library, and also from DESCRIPOTION (by default)

devtools support:

  • devtools sets the library path to the project package library, at load_all() or for any function that manipulates the package, e.g. check, test, etc.
  • it errors out if the project package library does not exist, or incomplete, telling you to call pkg_install
  • it checks that the installed versions satisfy the required ones. This might need to go online, though, e.g. to check if a GH version is the latest. So we might need a lighter version of the satisfies function.
  • it removes other project package libraries from the library path.

Problem with packages that are needed for pkgdepends/pkginstall

❯ pkg_install("r-lib/cli")
→ Updating CRAN metadata
✔ CRAN metadata current
✔ Found 34 dependencies for 1 packages (2.5s)
→ Building cli_1.0.0.9001_1b582695da869d87f4996b38d597f530248b43a6.tar.gz
✔ Got 1 packages, 1 downloaded (5.5s)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
  namespace ‘cli’ 1.0.0 is being loaded, but >= 1.0.0.9001 is required

✔ 212.6 MiB pkgman fix/messages*
❯ bt()

  1 pkgman::pkg_install ("r-lib/cli")
  2 pkginstall::install_packages (needs_install$file, lib = lib, plan = needs …
   at /Users/gaborcsardi/works/pkgman/R/package.R:50:5
  3 pkginstall::get_events (events, num_workers, lib, lock, bar)
  4 base::append (events$results, lapply(events$processes[done], function(x)  …
  5 base::lapply (events$processes[done], function(x) x$get_result())
  6 FUN (X[[i]], ...)
  7 x$get_result ()
  8 callr::rp_get_result (self, private)
  9 callr::get_result (out, private$options)
 10 base::stop (err[[2]])

 ✖ Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
  namespace ‘cli’ 1.0.0 is being loaded, but >= 1.0.0.9001 is required

Think about the lib_ and repo_ functions

I am not sure if we need to add them now. They are very small wrappers. I think it would be nice to have a good workflow first, wrt libraries, e.g. which package should be installed where, and also repositories, e.g. supporting adding repos via a config file.

@hadley @jimhester what do you think?

No error if package not found?

> pkgman::pkg_install("cran/pkgman")
  Updating CRAN metadataCRAN metadata current                                                                                                       
  Updating BioConductor metadataBioC metadata currentFound 57 dependencies for 1 packages in 3sNo downloads are needed38 dependencies already installed

pkgconfig fails with pkgdepends’, ‘pkginstall?

I understand that this is under pretty heavy development, so if this is premature......apologies in advance.

This might be a quick fix, but it seems like pkgconfig, pkgdepends, and pkginstall all fail on install?

> devtools::install_github("r-lib/pkgman")
Downloading GitHub repo r-lib/pkgman@master
from URL https://api.github.com/repos/r-lib/pkgman/zipball/master
Installing pkgman
Downloading GitHub repo r-lib/pkgdepends@master
from URL https://api.github.com/repos/r-lib/pkgdepends/zipball/master
Installing pkgdepends
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file  \
  --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/private/var/folders/c9/4v_941557p15th5c9lkxnysr0000gn/T/RtmpO7nUQ0/devtools966187b2236/r-lib-pkgdepends-d519403'  \
  --library='/Users/petergensler/Rlibs' --install-tests 

* installing *source* packagepkgdepends...
Warning in as.POSIXlt.POSIXct(x, tz) :
  unknown timezone 'zone/tz/2017c.1.0/zoneinfo/America/Chicago'
** R
** tests
** preparing package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  there is no package calledpkgconfigERROR: lazy loading failed for packagepkgdepends* removing/Users/petergensler/Rlibs/pkgdependsInstallation failed: Command failed (1)
Downloading GitHub repo r-lib/pkginstall@master
from URL https://api.github.com/repos/r-lib/pkginstall/zipball/master
Installing pkginstall
Downloading GitHub repo r-lib/pkgdepends@master
from URL https://api.github.com/repos/r-lib/pkgdepends/zipball/master
Skipping pkgdepends, it is already being installed.
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file  \
  --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/private/var/folders/c9/4v_941557p15th5c9lkxnysr0000gn/T/RtmpO7nUQ0/devtools9666d4c60c4/r-lib-pkginstall-042e444'  \
  --library='/Users/petergensler/Rlibs' --install-tests 

ERROR: dependencypkgdependsis not available for packagepkginstall* removing/Users/petergensler/Rlibs/pkginstallInstallation failed: Command failed (1)
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file  \
  --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/private/var/folders/c9/4v_941557p15th5c9lkxnysr0000gn/T/RtmpO7nUQ0/devtools966785653cf/r-lib-pkgman-75e3353'  \
  --library='/Users/petergensler/Rlibs' --install-tests 

ERROR: dependenciespkgdepends’, ‘pkginstallare not available for packagepkgman* removing/Users/petergensler/Rlibs/pkgmanInstallation failed: Command failed (1)
> devtools::session_info()
Session info -----------------------------------------------------------
 setting  value                       
 version  R version 3.4.2 (2017-09-28)
 system   x86_64, darwin15.6.0        
 ui       RStudio (1.1.383)           
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       <NA>                        
 date     2017-12-08                  

Packages ---------------------------------------------------------------
 package    * version    date       source                      
 assertthat   0.2.0      2017-04-11 CRAN (R 3.4.0)              
 backports    1.1.1      2017-09-25 CRAN (R 3.4.2)              
 base       * 3.4.2      2017-10-04 local                       
 callr        1.0.0.9000 2017-12-08 Github (r-lib/callr@550fa6b)
 clipr        0.4.0      2017-11-03 CRAN (R 3.4.2)              
 compiler     3.4.2      2017-10-04 local                       
 crayon       1.3.4      2017-09-16 CRAN (R 3.4.1)              
 curl         3.0        2017-10-06 CRAN (R 3.4.2)              
 datasets   * 3.4.2      2017-10-04 local                       
 debugme      1.1.0      2017-10-22 cran (@1.1.0)               
 devtools     1.13.4     2017-11-09 CRAN (R 3.4.2)              
 digest       0.6.12     2017-01-27 CRAN (R 3.4.0)              
 evaluate     0.10.1     2017-06-24 CRAN (R 3.4.1)              
 git2r        0.19.0     2017-07-19 CRAN (R 3.4.1)              
 graphics   * 3.4.2      2017-10-04 local                       
 grDevices  * 3.4.2      2017-10-04 local                       
 htmltools    0.3.6      2017-04-28 CRAN (R 3.4.0)              
 httpuv       1.3.5      2017-07-04 CRAN (R 3.4.1)              
 httr         1.3.1      2017-08-20 CRAN (R 3.4.1)              
 jsonlite     1.5        2017-06-01 CRAN (R 3.4.0)              
 knitr        1.17       2017-08-10 CRAN (R 3.4.1)              
 magrittr     1.5        2014-11-22 CRAN (R 3.4.0)              
 memoise      1.1.0      2017-04-21 CRAN (R 3.4.0)              
 methods    * 3.4.2      2017-10-04 local                       
 mime         0.5        2016-07-07 CRAN (R 3.4.0)              
 miniUI       0.1.1      2016-01-15 CRAN (R 3.4.2)              
 processx     2.0.0.1    2017-07-30 cran (@2.0.0.1)             
 R6           2.2.2      2017-06-17 CRAN (R 3.4.0)              
 Rcpp         0.12.14    2017-11-23 CRAN (R 3.4.3)              
 reprex     * 0.1.1      2017-01-13 CRAN (R 3.4.0)              
 rmarkdown    1.8        2017-11-17 CRAN (R 3.4.2)              
 rprojroot    1.2        2017-01-16 CRAN (R 3.4.0)              
 rstudioapi   0.7        2017-09-07 CRAN (R 3.4.1)              
 shiny        1.0.5      2017-08-23 CRAN (R 3.4.1)              
 stats      * 3.4.2      2017-10-04 local                       
 stringi      1.1.6      2017-11-17 CRAN (R 3.4.2)              
 stringr      1.2.0      2017-02-18 CRAN (R 3.4.0)              
 tools        3.4.2      2017-10-04 local                       
 utils      * 3.4.2      2017-10-04 local                       
 whisker      0.3-2      2013-04-28 CRAN (R 3.4.0)              
 withr        2.1.0.9000 2017-12-04 Github (r-lib/withr@fe81c00)
 xtable       1.8-2      2016-02-05 CRAN (R 3.4.0)              
 yaml         2.1.14     2016-11-12 CRAN (R 3.4.0)  

Include package version in messages

> pkgman::pkg_install("usethis")
✔ Resolving dependenciesusethis and its 34 dependencies already installed

Would be more useful as:

> pkgman::pkg_install("usethis")
✔ Resolving dependenciesusethis 1.0.0.9000 and its 34 dependencies already installed

Thoughts on initial bullets

Currently we get:

> pkg_install("tidyverse/rlang")
  Updating CRAN metadata                                                                                     
✔ CRAN metadata current                                                                                      
✔ Found 1 dependencies for 1 packages in 4.1s                                                                
✔                                                                                                            
✔ Built rlang (6.3s)                                                                                         
✔ Installed rlang (51ms)                                                                                     
Installed rlang_0.1.6.9003_594974198a0918a2983409bf79068a671ec089ab.tar.gz (7.3s).                           
  • I think Updating CRAN metadata should get a tick in front of it
  • Should we start with something like "Installing 1 package" ?
  • There's an empty check mark after "found dependencies"
  • Why is "found 1 dependencies" in red?
  • Can we a have final bullet more like "Installed rlang 0.1.6 (sha1) from GitHub" ?

pkg_functions

  • pkg_install(“sf”) # install from cran without prefix
  • local_pkg_install() - pkgdepends does not currently work with directories. pkginstall does, but we need to also query / install the dependencies.
  • local_pkg_install_deps()
  • local_pkg_install_dev_deps()
  • pkg_update() # default updates all packages
  • pkg_remove()
  • pkg_status()

lib_temporary() less useful than expected

pkgman::lib_temporary()
.libPaths()
#> [1] "/private/tmp/RtmpFue9UC/library-5d2022749503"                  
#> [2] "/Library/Frameworks/R.framework/Versions/3.4/Resources/library"

pkgman::pkg_install("purrr", num_workers = 2)
#> Error in loadNamespace(name) : there is no package called ‘pkgdepends’

It's not clear this is a bug, but it does seem less useful than I had hoped.

Object r not found

> pkgman::pkg_install("r-lib/pkgman")
  Updating CRAN metadata                                                                                     
✔ CRAN metadata current                                                                                      
  Updating BioConductor metadata                                                                             
✔ BioC metadata current                                                                                      
✔ Found 57 dependencies for 1 packages in 6.6s                                                               
✔ No downloads are needed
 Error in remotes_stop_for_solution_download_error(self, private) : 
  object 'r' not found 
3. remotes_stop_for_solution_download_error(self, private) 
2. r$stop_for_solution_download_error() 
1. pkgman::pkg_install("r-lib/pkgman") 

Better subprocess control

After #57.

Since we are only running the subprocess synchronously currently, we can do a better job managing the subprocess. In particular:

  • If it is busy at the beginning of the call, kill it and restart it. It should not be busy.
  • If it is starting at beginning of the call, wait for it, with a timeout.
  • If it is busy at the end of the call (in on.exit), kill it and restart it. It should not be busy at this point. (Maybe we could try to interrupt is first, with a very small timeout.)

Give warnings when library contains packages built with a different major or minor version of R

There are many strange bugs that can happen when you load a package built on a different major or minor version of R. We've spent a lot of time remotely debugging these problems for users and eventually I wrote an article about it. http://shiny.rstudio.com/articles/upgrade-R.html

It would be best if library() would automatically warn when loading a package like this, but we can't change that directly, so pkgman seems like a reasonable place to do this check. If you think this should go elsewhere, please let me know.

cc: @schloerke, @alandipert, @tmastny. (Today this group spent hours tracking down a crash that was probably due packages built on an old version of R.)

Fails to install usethis from github

> pkgman::pkg_install("r-lib/usethis")
✔ Resolving dependencies                                                                                               
Error in basename(names(x)) : a character vector argument expected                                                     
In addition: Warning messages:
1: In type_cran_make_resolution(remote, dir$platform, dir$rversion,  :
  Non-unique resolve:lattice2: In structure(unlist(events$results, recursive = FALSE), class = "installation_results",  :

Print package version?

e.g.

> pkgman::pkg_install("feather")
✔ Resolving dependencies                                                         
✔ Installed feather 0.3.1 (98ms)                                                       

Identify installed packages by source

It would be useful to be able to identify the install source of installed packages (CRAN, BioC, GitHub repo,...). My current use-case is identifying which packages are installed from GitHub ahead of CRAN, so I can revert those packages to CRAN versions for a stable environment for teaching/reproducibility.

Failure on install

> pkgman::pkg_install("cran::usethis")
✔ Resolving dependenciesFailed NA                                                                                                            
Error: '/tmp/Rtmp93O7EF/file9f709b44e9/NA' is not a readable file path         
In addition: Warning message:
In type_cran_make_resolution(remote, dir$platform, dir$rversion,  :                                     
> traceback()
10: stop(err[[2]]) at result.R#35
9: get_result(out, private$options) at r-process.R#89
8: rp_get_result(self, private) at r-process.R#50
7: x$get_result() at install.R#124
6: FUN(X[[i]], ...)
5: lapply(events$processes[done], function(x) x$get_result()) at install.R#124
4: append(events$results, lapply(events$processes[done], function(x) x$get_result())) at install.R#124
3: get_events(events, num_workers, lib, lock, bar) at install.R#109
2: install_packages(plan$file, lib = lib, plan = plan, num_workers = num_workers) at package.R#36
1: pkgman::pkg_install("cran::usethis")

I did a install_github("r-lib/pkgman") to install

Version behaviour for older R versions

Should it behave like install.packages and only give you the binary version? (Which might be very out of date) Should it warn that a newer version is available? Should I prompt? Should it use declared version requirements?

Missing status update

> pkgman::pkg_install("tidyverse/haven")
  Updating CRAN metadata                                                                                                      
✔ CRAN metadata current                                                                                                       
✔ Found 26 dependencies for 1 packages in 939ms                                                                               
  Downloading packages [1/1] [393.01 kB] 00:00:01                                                                             

Then nothing happened for a while, presumably because haven is building from source, but we need something to say that's happening

no package called rex?

When trying to install pkgman from github, I keep getting this error:

> devtools::install_github("r-lib/pkgman")
Downloading GitHub repo r-lib/pkgman@master
from URL https://api.github.com/repos/r-lib/pkgman/zipball/master
Installing pkgman
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ  \
  --no-save --no-restore --quiet CMD INSTALL  \
  '/private/var/folders/c9/4v_941557p15th5c9lkxnysr0000gn/T/Rtmpgkl2d1/devtools68e3b37a029/r-lib-pkgman-ecc4396'  \
  --library='/Users/petergensler/Rlibs' --install-tests 

* installing *source* packagepkgman...
Warning in as.POSIXlt.POSIXct(x, tz) :
  unknown timezone 'zone/tz/2017c.1.0/zoneinfo/America/Chicago'
** R
** byte-compile and prepare package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  there is no package calledrexERROR: lazy loading failed for packagepkgman* removing/Users/petergensler/Rlibs/pkgmanInstallation failed: Command failed (1)

Just for reference, I do have two different .libpaths, so maybe this is where things go haywire?

> .libPaths()
[1] "/Users/petergensler/Rlibs"                                     
[2] "/Library/Frameworks/R.framework/Versions/3.4/Resources/library"

Let me know if you need anything else.

pkgdepends and boxes are not available for pkginstall/pkgman?

Hello,

It seems the repo is relatively new, so apologies in advance if these comments are too premature:

It might be helpful to note on the readme that you need the libarchive package (on any OS like Debian/Linux builds only?) to make this work, which you can get via brew:

brew install libarchive

When I try to install from GitHub via devtools::install_github("r-lib/pkgman"), I get the following errors:

Downloading GitHub repo r-lib/pkgman@master
ERROR: dependency ‘boxes’ is not available for package ‘pkgdepends’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/pkgdepends’
Installation failed: Command failed (1)

and

ERROR: dependency ‘pkgdepends’ is not available for package ‘pkginstall’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/pkginstall’
Installation failed: Command failed (1)
ERROR: dependencies ‘pkgdepends’, ‘pkginstall’ are not available for package ‘pkgman’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/pkgman’
Installation failed: Command failed (1)

Is this due to me using R 3.4.2? Let me know if you would like the full logs for more information.
I'm assuming that I should be installing pkgdepends from a certain branch/PR on GitHub to test?

Below is my sessioninfo:

> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.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 utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] httr_1.3.1       compiler_3.4.2   R6_2.2.2         tools_3.4.2      withr_2.1.0.9000 curl_3.0         memoise_1.1.0   
 [8] git2r_0.19.0     digest_0.6.12    devtools_1.13.3 

Package versions in installation messages

Not sure which package this is coming from, but I think that:

> pkg_install("r-lib/usethis")
→ Updating CRAN metadata                                                                                          
✔ CRAN metadata current                                                                                           
✔ Found 74 dependencies for 1 packages in 5.2s                                                                    
✔ 1 packages, 1 downloaded, in 670ms                                                                              
✔ Installed cli (144ms)                                                                                         
Installed cli_1.0.0.tgz (1.9s).                                                                                 

would be better as

> pkg_install("r-lib/usethis")
→ Updating CRAN metadata                                                                                          
✔ CRAN metadata current                                                                                           
✔ Found 74 dependencies for 1 packages in 5.2s                                                                    
✔ 1 packages, 1 downloaded, in 670ms                                                                              
✔ Installed cli 1.0.0 (144ms)                                                                                         

Failure on first download

I reliably get this on first download:

> pkgman::pkg_install("feather")
✔ Resolving dependencies                                                         
[0/1] 00:00:00 | ETA:  ?s | ???
 Error: '/tmp/RtmpgDtU6z/file3c2b76b80368/bin/macosx/el-capitan/contrib/3.4/feather_0.3.1.tgz' is not a readable file path 

Better failure on solution error

Instead of this:

❯ pkg_install("foobar")
  Updating CRAN metadata
✔ CRAN metadata current
  Updating BioConductor metadata
✔ BioC metadata current
✔ Found 0 dependencies for 1 packages in 2.1s
✔ No downloads are needed
Error: Columns `ref`, `package`, `type`, `version`, `file` must be 1d atomic vectors or lists
In addition: Warning message:
In structure(x, class = unique(c("AsIs", oldClass(x)))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
❯ pkg_install(c("r-lib/usethis", "cran::usethis"))
  Updating CRAN metadata
✔ CRAN metadata current
✔ Found 64 dependencies for 2 packages in 2.1s
✔ No downloads are needed
Error: Columns `ref`, `package`, `type`, `version`, `file` must be 1d atomic vectors or lists
In addition: Warning message:
In structure(x, class = unique(c("AsIs", oldClass(x)))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.