pak icon indicating copy to clipboard operation
pak copied to clipboard

Refining system requirements

Open michaelmayer2 opened this issue 1 year ago • 4 comments

This is an early version of a PR that will enhance pak::pkg_system_requirements() so that it will check all R and Bioconductor type repositories on a given packagemanager (only URL of packagemanager needs to be specified) and extract system dependencies of a given set of packages.

Previously, pak::pkg_system_requirements() only worked for a single repository and the list of packages had to be split before making a function call.

In addition, the PR also automatically detects if a repository is of type Bioconductor and then appends bioc_version=x.y to the API call.

Example:

> pak::pkg_system_requirements(c("tidyverse","clustermq","flowcatchR"), os="ubuntu", os_release="20.04")
[1] "apt-get install -y  imagemagick  libmagick++-dev  gsfonts  libfreetype6-dev  libfribidi-dev  libharfbuzz-dev  libfontconfig1-dev  pandoc  libicu-dev  libjpeg-dev  libpng-dev  libtiff-dev  libzmq3-dev  zlib1g-dev  libssl-dev  make  libxml2-dev  libcurl4-openssl-dev"
> pak::pkg_system_requirements(c("tidyverse","clustermq","flowcatchR"), os="centos", os_release="7")
[1] "yum install -y epel-release"                                                                                                                                                                                                                                             
[2] "yum install -y  ImageMagick  ImageMagick-c++-devel  freetype-devel  fribidi-devel  harfbuzz-devel  fontconfig-devel  pandoc  libicu-devel  libjpeg-turbo-devel  libpng-devel  libtiff-devel  zeromq-devel  zlib-devel  openssl-devel  make  libxml2-devel  libcurl-devel"

Without the PR pak will report

> pak::pkg_system_requirements(c("tidyverse","clustermq","flowcatchR"), os="ubuntu", os_release="20.04")
Error: 
! error in pak subprocess
Caused by error in `asNamespace("pak")$system_requirements_internal(...)`:
! Could not locate package 'flowcatchR'
Type .Last.error to see the more details.

which is expected as flowcatchR is a Bioconductor package and as such not in the (default) CRAN repo.

Note:

  • I deliberately left some verbose debug statements in. Also the code probably can be streamlined further by a more skilled R developers. Just wanted to make a start to get this functionality in in order to increase it's usability.
  • the question around Bioconductor support probably needs to be discussed in more detail as the current PR has a hard dependency on the R package BiocManager.

michaelmayer2 avatar Jul 07 '23 09:07 michaelmayer2