You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to deploy a Plumber API that is using ‘renv’ via rsconnect::deployApp(). I am calling deployApp() from outside that project because I don’t want to add the ‘rsconnect’ package as a dependency to my project (I want to keep its dependencies as lean as possible).
Unfortunately this fails since the packages inside the Plumber API renv have different versions than the ones outside the project:
── Preparing for deployment ────────────────────────────────────────────────────
[…]
ℹ Capturing R dependencies from renv.lock
Error in `parseRenvDependencies()`:
! Library and lockfile are out of sync
ℹ Use renv::restore() or renv::snapshot() to synchronise
ℹ Or ignore the lockfile by adding to your .rscignore
Backtrace:
▆
1. └─rsconnect (local) deployApp(dir, appId = app_id, account = "default", server = "default")
2. └─rsconnect:::bundleApp(...)
3. └─rsconnect:::createAppManifest(...)
4. └─rsconnect:::bundlePackages(...)
5. └─rsconnect:::computePackageDependencies(...)
6. └─rsconnect:::parseRenvDependencies(bundleDir)
7. └─cli::cli_abort(...)
8. └─rlang::abort(...)
And indeed I can recapitulate this by looking at the package versions between my plumber-api project and the currently active project.
I also tried activating the plumber-api renv project before calling deployApp() via renv::load('plumber-api') but that doesn’t solve the issue, since parseRenvDependencies() internally calls packageDescription(…, lib.loc = NULL) to find the installed package version; however, for packages that are already loaded this will read the loaded package’s package description, not the ones from the suitable renv library.
Keeping the dependencies between these two projects in sync would be a non-trivial effort.
I’m happy to create a PR but I don’t really know how to create a good, self-contained test case for that — I’d have to create a mock package and install two different versions of that in two different projects.
The text was updated successfully, but these errors were encountered:
Actually bundleDir isn’t what I thought it is, and consequently renv::paths$library(project = bundleDir) doesn’t actually work. But using .libPaths() instead should work.
@soetang I think you might be right. However, I am a bit confused by the discussion: I don’t really understand why ‘rsconnect’ would require any of these hoops. As far as I can tell the issue is really due to the fact that parseRenvDependencies() simply looks for dependencies in the wrong location (= it does not realise that the currently active renv might not be the renv of the project-to-be-deployed).
If I am right, no user action should be necessary, and this should be fixed inside parseRenvDependencies() (looking at it again, the fix from my initial post should work… should it not?).
I am trying to deploy a Plumber API that is using ‘renv’ via
rsconnect::deployApp()
. I am callingdeployApp()
from outside that project because I don’t want to add the ‘rsconnect’ package as a dependency to my project (I want to keep its dependencies as lean as possible).Unfortunately this fails since the packages inside the Plumber API renv have different versions than the ones outside the project:
And indeed I can recapitulate this by looking at the package versions between my
plumber-api
project and the currently active project.I also tried activating the
plumber-api
renv project before callingdeployApp()
viarenv::load('plumber-api')
but that doesn’t solve the issue, sinceparseRenvDependencies()
internally callspackageDescription(…, lib.loc = NULL)
to find the installed package version; however, for packages that are already loaded this will read the loaded package’s package description, not the ones from the suitable renv library.Keeping the dependencies between these two projects in sync would be a non-trivial effort.
I believe the fix would be to replace
rsconnect/R/bundlePackageRenv.R
Line 51 in 9999fdb
with
I’m happy to create a PR but I don’t really know how to create a good, self-contained test case for that — I’d have to create a mock package and install two different versions of that in two different projects.
The text was updated successfully, but these errors were encountered: