Closed FMKerckhof closed 2 years ago
I tried to run jetpack check
from outside of R (i.e. via the CLI) - which also resulted the message that renv is missing. Adding it via the CLI jetpack add renv@0.15.4
failed with the error "" does not exist
Hey @FMKerckhof, Jetpack should add renv to renv.lock
when calling migrate()
(relevant code), but if that's not happening for some reason, you can try adding it manually:
"renv": {
"Package": "renv",
"Version": "0.15.4",
"Source": "Repository",
"Repository": "CRAN",
"Hash": "c1078316e1d4f70275fc1ea60c0bc431",
"Requirements": []
},
thank you - I don't know why migrate didn't add, looking at your code, but manually adding the entry allowed me to resolve the issue.
A question on portability @ankane : after jetpack::install(deployment=TRUE), when I want to add packages (or change to specific versions of them or add remote packages) jetpack::add()
will update the DESCRIPTION (and renv.lock?), but only in the virtual environment, is that correct? - therefore they will not be picked up by git. What is the advised way to include these changes under version control?
jetpack::add()
will update DESCRIPTION
and renv.lock
in the project directory, which should be checked into version control. Also, fwiw, deployment=TRUE
is meant to be used for deploying code to a production environment rather than an environment where you're adding packages.
Summary of my (general) question: does renv need to be in the renv.lock file for jetpack to work? If so: should this be taken care of by
jetpack::migrate
?The reason for this question is outlined below, I have not able to resolve it so far. I apologize for not really providing a code reprex, but I think I describe the process in enough detail to reproduce.
Goal of the issue
For a legacy deploy I am running R3.6.2 in WSL1 Ubuntu 18.04 - I am trying to better understand the interplay between
jetpack
and it'srenv
backend - the ultimate aim is to build a docker image as outlined in the README of jetpack here, runninginit.R
in the DOCKERFILE will take care of the installation of jetpack and dependents. First, I want to be able to interactively tweak a few more packages and versions.Set-up
Hence, for interactive work, R 3.6.2 was installed from Rstudio-provided binaries, and I only installed
remotes
andjetpack
(0.5.2) as additional packages. Jetpack will automatically install renv (0.15.4) upon install, since it is a dependency. Hence the 'system' R library has access to both jetpack and renv.The project used to be under jetpack/packrat control (older versions of jetpack used packrat) and I have run
jetpack::migrate
and deleted the packrat.lock file. Therefore, the project folder has a DESCRIPTION and renv.lock file inside. The packagerenv
itself is not part of the renv.lock file, since it should be installed when installing jetpack through init.R in the DOCKERFILE and is system-available.Workflow and problems
When I clone from github and start R, jetpack will ask me if I want to create a virtual environment, which I agreed to.
Now, I want to run
jetpack::install(deployment=TRUE)
in order to restore my renv. First, I ranjetpack::check()
which showed me that renv is missing.It appears that in the virtual environment, renv was not present. However, running
renv::status()
does list the package as installed:running
renv::depencies
will listrenv
as a dependency because there is a lockfile present -getMissing
will therefore always throw a diff if renv is not in the lockfile (even if it is available).Hence I proceeded with taking jetpack's advice and using
jetpack::install()
-> I assumed that this would add renv to the virtual (sandbox) environment - which results in a very odd error:So clearly, something is off with the normal way of doing things. If the "missingness" of renv is the problem, let's just record it into the lockfile?
Clearly that tries to update the renv.lock in the virtual environment, but not the original one in the project directory (which remains untouched).
jetpack::check()
keeps on telling me there is no renv.Since I was stumped at this stage I decided to quit R, remove the project and clone it again. From then on, it appears that I could not run a single jetpack command anymore because of errors in the
Loading renv (
library(renv)
) does not help quitting R doesn't help either, starting R with--no-restore
(or vanilla) neither.My
sessionInfo()
output (after running library("renv")) is: