NGaffney
NGaffney

Reputation: 1532

R doesn't respect maximum version when installing package dependencies

Say I'm developing a package called magicr to do some statistical magic and I want it to use functions from another package called fairydust which (hypothetically) exists on CRAN.

Unfortunately fairydust has just released version 2.0.0 to CRAN and completely broken the functions I was planning to use.

So I update my DESCRIPTION

Imports:
     fairydust (<= 1.9.9)

And build the package and try a test install into a clean library

devtools::install_local("~path/to/magicr")

Installing magicr
Installing 1 package: fairydust
Installing package into /path/to/current/library/fairydust
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/fairydust_2.0.0.zip'
Content type 'application/zip' length 11235813 bytes (11.2 MB)
downloaded 11.2 MB

package ‘fairydust’ successfully unpacked and MD5 sums checked

* installing *source* package 'magicr' ...
** R
** inst
** tests
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
  namespace 'fairydust' 2.0.0 is being loaded, but <= 1.9.9 is required
ERROR: lazy loading failed for package 'magicr'
* removing 'path/to/current/library/magicr'
Error: Command failed (1)

So when resolving dependencies it simply installed the most recent version of fairydust from CRAN and then checked the version when trying to load magicr.

Is there a way to get the required version of fairydust automatically when magicr is installed without building and pointing to a custom repository (a la drat and miniCRAN).

Upvotes: 3

Views: 235

Answers (1)

pan0ramic
pan0ramic

Reputation: 183

I know that this is super old but since this was a top hit in my search: R apparently does not respect maximum versions, just >=

Source

Upvotes: 2

Related Questions