Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set available_package_filters option before calling pkgAvail() directly/indirectly #135

Open
hturner opened this issue May 14, 2024 · 3 comments

Comments

@hturner
Copy link
Contributor

hturner commented May 14, 2024

miniCRAN::pkgAvail() calls utils::available.packages() with filters = NULL by default. As documented in ?available.packages, this corresponds to a default set of filters: c("R_version", "OS_type", "subarch", "duplicates"), which means that it excludes packages whose OS requirement is incompatible with the current OS and excludes those with compiled code that is not available for the current sub-architecture.

In other words, running offlinedatasci install r-packages tmp on Windows excludes packages that are compiled for macOS, which is quite a lot!

Unfortunately miniCRAN::makeRepo calls pkgAvail() without setting any filters argument, so the only way to control this at the moment is to set the available_packages_filters option. I think you want:

options(available_packages_filters = "duplicates")

Also dropping "R_version" as this is already handled by setting the URL and potentially someone could try setting up a miniCRAN for R 4.4 (say) when their current version of R is a different version.

@ethanwhite
Copy link
Collaborator

Thanks for this @hturner! Can you provide a specific example of the differences you see with and without options(available_packages_filters = "duplicates") so that we can compare to that. A few quick examples on Linux didn't show any differences so we're just trying to figure out where to look.

@ethanwhite ethanwhite added the Awaiting author contribution Waiting on the issue author to do something before proceeding label May 15, 2024
@hturner
Copy link
Contributor Author

hturner commented May 16, 2024

Yes, here's one:

repos <- "https://cloud.r-project.org"
type <- "mac.binary.big-sur-arm64"
pp <- available.packages(miniCRAN:::contribUrl(repos, type, "4.4"), 
                         type = type, 
                         filters = c("R_version", "OS_type",
                                     "subarch", "duplicates"))
pp["fs", 1:3]
#> Error in pp["fs", 1:3]: subscript out of bounds
pp <- available.packages(miniCRAN:::contribUrl(repos, type, "4.4"), 
                         type = type, filters = "duplicates")
pp["fs", 1:3]
#>  Package  Version Priority 
#>     "fs"  "1.6.4"       NA

Created on 2024-05-16 with reprex v2.1.0

Also jsonlite was another. They have Archs: <package_name>.so.dSYM in https://cloud.r-project.org/bin/macosx/big-sur-arm64/contrib/4.4/PACKAGES.

@github-actions github-actions bot removed the Awaiting author contribution Waiting on the issue author to do something before proceeding label May 16, 2024
@ethanwhite
Copy link
Collaborator

Thanks @hturner! Looks like it is pretty likely that the miniCRAN maintainer will have a fix in for this shortly so we're going to let this sit for a week or so and see if we can make a minimal change relying on the upstream fix. If it doesn't come in soon we'll either work around with options() or install straight from the GitHub dev branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants