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 missing packages when renv.verbose = FALSE #1607

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

Comments

@aronatkins
Copy link
Contributor

Use a non-renv project where the R library does not contain a package. In my case, the R library is missing tidyr and there is an R file containing a library(tidyr) statement.

options(renv.verbose = FALSE)
deps <- renv::dependencies(getwd())
renv::snapshot(getwd(), packages = deps$Package, prompt = FALSE)
#> What do you want to do? 
#> 
#> 1: Snapshot, just using the currently installed packages.
#> 2: Install the packages, then snapshot.
#> 3: Cancel, and resolve the situation on your own.
#> 
#> Selection: 3
#> - Operation canceled.
options(renv.verbose = NULL)
renv::snapshot(getwd(), packages = deps$Package, prompt = FALSE)
#> The following required packages are not installed:
#> - tidyr
#> Packages must first be installed before renv can snapshot them.
#> Use `renv::dependencies()` to see where this package is used in your project.
#> 
#> What do you want to do? 
#> 
#> 1: Snapshot, just using the currently installed packages.
#> 2: Install the packages, then snapshot.
#> 3: Cancel, and resolve the situation on your own.
#> 
#> Selection: 3
#> - Operation canceled.

When run in a non-interactive session, the output is even less helpful:

- Operation canceled.
Execution halted
@aronatkins aronatkins changed the title snapshot does not report problems when renv.verbose = FALSE snapshot does not report missing packages when renv.verbose = FALSE Jul 27, 2023
@kevinushey
Copy link
Collaborator

We should audit usages of writef() that are used to report error output, and use a different function (ewritef()?) that ignores renv.verbose (or respects a different variable if people really want that to be quiet)

@kevinushey
Copy link
Collaborator

Open to alternatives too; e.g. different names; override in writef() to force printing; whatever else feels clean.

@kevinushey
Copy link
Collaborator

info() / caution()?

@kevinushey
Copy link
Collaborator

kevinushey commented Jul 27, 2023

#1603 (review) (consider usages within dependency discovery warnings)

@kevinushey
Copy link
Collaborator

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

@kevinushey kevinushey added this to the 1.0.1 milestone Jul 28, 2023
@aronatkins
Copy link
Contributor Author

@kevinushey Sadly, no. I'm seeing the following in the deploy pane:

ℹ Capturing R dependencies with renv
Traceback (most recent calls last):
9: rsconnect::deployApp(appDir = "~/dev/customer/rsconnect-934/FlowDataPull", 
       appFileManifest = "/var/folders/jx/1zpr1wkj3bb6lv62_mfylt7c0000gn/T/9254-9759-8e29-f87c", 
       account = "XXX", server = "XXX", 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

@aronatkins
Copy link
Contributor Author

That previous trace was caused when the dflowR package was installed from source. Installing from GitHub avoids the trace.

When the tidyr package is not installed, we get good output in the deploy pane:

ℹ Capturing R dependencies with renv
The following required packages are not installed:
- tidyr
Packages must first be installed before renv can snapshot them.
Use `renv::dependencies()` to see where this package is used in your project.

- Operation canceled.
Execution halted

@aronatkins
Copy link
Contributor Author

@kevinushey maybe consider this issue solved and #1608 still open, then?

@kevinushey
Copy link
Collaborator

Thanks! I'll do that.

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