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

snapshot does not report installed-from-source packages when renv.verbose = FALSE #1608

Closed
aronatkins opened this issue Jul 27, 2023 · 7 comments

Comments

@aronatkins
Copy link
Contributor

rsconnect calls renv::snapshot with renv.verbose = FALSE. From a push-button deploy session, we see:

ℹ Capturing R dependencies with renv
Error in renv_snapshot_validate_report(valid, prompt, force) : 
  aborting snapshot due to pre-flight validation failure
Calls: <Anonymous> ... snapshotRenvDependencies -> <Anonymous> -> renv_snapshot_validate_report
Execution halted

In rstudio/rsconnect#934, we believe that this may have been caused by installing the dflowR package from source rather than from GitHub.

From the console, this looks like:

options(renv.verbose = FALSE)
deps <- renv::dependencies(getwd())
renv::snapshot(getwd(), packages = deps$Package, prompt = FALSE)
#> Error in renv_snapshot_validate_report(valid, prompt, force) : 
#>   aborting snapshot due to pre-flight validation failure
options(renv.verbose = NULL)
renv::snapshot(getwd(), packages = deps$Package, prompt = FALSE)
#> The following package(s) were installed from an unknown source:
#> - dflowR [0.01.1]
#> renv may be unable to restore these packages in the future.
#> Consider reinstalling these packages from a known source (e.g. CRAN).
#> 
#> Error in renv_snapshot_validate_report(valid, prompt, force) : 
#>   aborting snapshot due to pre-flight validation failure

renv should report problems even when renv.verbose=FALSE

@kevinushey
Copy link
Collaborator

I've merged #1610; @aronatkins can you let me know if all looks well now?

@aronatkins
Copy link
Contributor Author

See #1607 (comment)

I tested this issue and #1607 together; half way there. Living on a prayer? 😁

@aronatkins
Copy link
Contributor Author

Outside the deploy pane, we do not receive a stack.

ℹ Capturing R dependencies with renv
Error in renv_snapshot_validate_report(valid, prompt, force) : 
  aborting snapshot due to pre-flight validation failure

@aronatkins
Copy link
Contributor Author

From the RStudio IDE deploy pane (using push-button deploy):

ℹ Capturing R dependencies with renv
The following package(s) were installed from an unknown source:
- dflowR [0.01.1]
renv may be unable to restore these packages in the future.
Consider reinstalling these packages from a known source (e.g. CRAN).

Traceback (most recent calls last):
9: rsconnect::deployApp(appDir = "~/dev/rstudio/standalone/rsconnect-934/FlowDataPull", 
       appFileManifest = "/var/folders/8j/pt4fjhkj11d3xd9344pdspmh0000gn/T/d841-e345-4727-6dda", 
       account = "aron", server = "rsc.radixu.com", appName = "flowdatapull", 
       appTitle = "FlowDataPull", launch.browser = function(url) {
           message("Deployment completed: ", url)
       }, lint = FALSE, metadata = list(asMultiple = FALSE, asStatic = FALSE))
8: bundleApp(appName = target$appName, appDir = appDir, appFiles = appFiles, 
       appMetadata = appMetadata, quiet = quiet, verbose = verbose, 
       pythonConfig = pythonConfig, image = image)
7: createAppManifest(appDir = bundleDir, appMetadata = appMetadata, 
       users = users, pythonConfig = pythonConfig, retainPackratDirectory = TRUE, 
       image = image, verbose = verbose, quiet = quiet)
6: bundlePackages(bundleDir = appDir, extraPackages = extraPackages, 
       verbose = verbose, quiet = quiet)
5: computePackageDependencies(bundleDir, extraPackages, quiet = quiet, 
       verbose = verbose)
4: snapshotRenvDependencies(bundleDir, extraPackages, verbose = verbose)
3: renv::snapshot(bundleDir, packages = deps$Package, prompt = FALSE)
2: renv_snapshot_validate_report(valid, prompt, force)
1: stop("aborting snapshot due to pre-flight validation failure")
Error in renv_snapshot_validate_report(valid, prompt, force) : 
  aborting snapshot due to pre-flight validation failure
Calls: <Anonymous> ... snapshotRenvDependencies -> <Anonymous> -> renv_snapshot_validate_report
Execution halted

From the R console in the RStudio IDE:

ℹ Capturing R dependencies with renv
The following package(s) were installed from an unknown source:
- dflowR [0.01.1]
renv may be unable to restore these packages in the future.
Consider reinstalling these packages from a known source (e.g. CRAN).

Error in renv_snapshot_validate_report(valid, prompt, force) : 
  aborting snapshot due to pre-flight validation failure

Is it possible to suppress the stack in the deploy pane?

@kevinushey
Copy link
Collaborator

The simplest way would be to set up some dummy error handler, e.g. options(error = function() {}):

renv/R/scope.R

Lines 80 to 96 in d690785

renv_scope_error_handler <- function(scope = parent.frame()) {
error <- getOption("error")
if (!is.null(error))
return(FALSE)
call <- renv_error_handler_call()
options(error = call)
defer({
if (identical(getOption("error"), call))
options(error = error)
}, scope = scope)
TRUE
}

Alternatively, use some option / setting to enable / disable it?

@kevinushey
Copy link
Collaborator

We've decided to leave this as-is on the renv side; I think setting the error option on the rsconnect side would be a sufficient workaround.

@RakeshNandi1990
Copy link

RakeshNandi1990 commented Feb 21, 2024

use
renv::snapshot()
and
1: Activate the project and use the project library.

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

3 participants