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

Teach renv about RSPM binaries #124

Closed
slopp opened this issue Aug 5, 2019 · 10 comments
Closed

Teach renv about RSPM binaries #124

slopp opened this issue Aug 5, 2019 · 10 comments

Comments

@slopp
Copy link
Contributor

@slopp slopp commented Aug 5, 2019

RSPM repositories can provide users linux package binaries if users set the repo option correctly.

For examples, see: http://cluster.rstudiopm.com/client/#/repos/1/overview

Packrat should remove the linux component of the URL to ensure the projects remain portable across distros.

@kevinushey
Copy link
Collaborator

@kevinushey kevinushey commented Aug 6, 2019

Should renv also provide some kind of mechanism to opt-in to the use of binaries from RSPM?

kevinushey added a commit that referenced this issue Aug 6, 2019
@slopp
Copy link
Contributor Author

@slopp slopp commented Aug 6, 2019

Users would typically opt-in by setting the repo url, do you have other ideas for how this could work though?

e.g. I guess renv could try to see if a repository supports the linux structure and point the user in that direction? IDK if renv would be able to figure out reliably what OS it is running on and which repo URL to select automatically

@kevinushey
Copy link
Collaborator

@kevinushey kevinushey commented Aug 6, 2019

Users would typically opt-in by setting the repo url, do you have other ideas for how this could work though?

Right, but because only the unadorned repository URL will enter the lockfile (ie: stripped of /__linux__/<platform>/), binaries will effectively be "turned off" by default in renv. So, I think we need some mechanism for turning that back on. Does that make sense?

Is there a simple way to query an CRAN repository to ask if it's RSPM + binaries are available for a particular platform?

@slopp
Copy link
Contributor Author

@slopp slopp commented Aug 7, 2019

@jonyoder do you know if this this type of info is easily available? Maybe related to https://github.com/rstudio/package-manager/issues/1245

@jonyoder
Copy link

@jonyoder jonyoder commented Aug 7, 2019

We have some of this info in the status API:

http://cluster.rstudiopm.com/__api__/status:

{
    "version": "1.0.11-1235",
    "metrics_enabled": true,
    "r_configured": true,
    "binaries_enabled": true,
    "binary_distros": [
        {
            "url": "centos6",
            "display": "CentOS/RHEL 6"
        },
        {
            "url": "centos7",
            "display": "CentOS/RHEL 7"
        },
        {
            "url": "opensuse42",
            "display": "OpenSUSE 42.3, SLES 12.3"
        },
        {
            "url": "opensuse15",
            "display": "OpenSUSE/SLES 15"
        },
        {
            "url": "xenial",
            "display": "Ubuntu 16.04 (Xenial)"
        },
        {
            "url": "bionic",
            "display": "Ubuntu 18.04 (Bionic)"
        }
    ]
}

If renv only cares about the default distros that we distribute with RSPM, then you could pretty easily call this API and match up the url property to the OS renv has detected. If we need to support a true lookup, we could also create an API that expects some parameters like OS, distro, and version and then return a list of identifiers that match that spec.

For now, I expect the /status API above would be just fine.

@jonyoder
Copy link

@jonyoder jonyoder commented Aug 7, 2019

@kevinushey, I should have mentioned that the above six distros (identified by the url property in the JSON) are baked into RSPM. Over time, this list will change as we add and drop support for operating systems. For example, we're currently working on adding RHEL 8 support, and its identifier will probably be fedora28 when it appears.

@jaredlander
Copy link

@jaredlander jaredlander commented Jan 9, 2020

I think I'm being bit by this now. Using RSPM to install packages and when I go to restore the project in a Docker image, R is installing from source rather than the binaries, so now I'm waiting for packages to compile. I got around it by setting the repos argument in renv::restore(), but something about that seems brittle. For instance, what if I am pulling from multiple repos in RSPM and now the Dockerfile has to be kept abreast of that.

@kevinushey
Copy link
Collaborator

@kevinushey kevinushey commented Mar 8, 2020

This should be implemented now in the latest version of renv on master. If you're using an RSPM URL, renv should automatically ensure that:

  1. The source URL is stored in the lockfile, and
  2. The appropriate binary URL is used during restore.

Let me know if you run into any problems or don't see this behavior.

@jaredlander
Copy link

@jaredlander jaredlander commented Mar 9, 2020

I'll give it a shot. But now, a related use case. I'm developing using using my RSPM. Then I migrate the code to the customer's system and want to use their RSPM. Do I manually edit the lockfile?

@kevinushey
Copy link
Collaborator

@kevinushey kevinushey commented Mar 24, 2020

Sorry for the late response. Depending on how you want to set the repositories, you could do so either by:

  1. Manually editing the lockfile,
  2. Use renv::modify() to edit the lockfile,
  3. Use an explicit repos argument in restore().

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

Successfully merging a pull request may close this issue.

4 participants