multiple distribution package devops


I am a little confused on the best way to approach developing R packages with multiple OS environments considered. I also happen to be new at developing packages in R, but I have been using R for a few years.

For instance, I have realized that build_site() appears to behave differently when ported with an .Rproj.user into a different system, creating an error with builds. In Windows 11, I used roxygen documentation methods and then used build site to build the .html docs to see how they rendered. I then copied this into my WSL Ubuntu 22.04 distro. Additionally, I may later be developing on my remote Ubuntu 20.04 server. When running build_site() on Ubuntu 22.04, I ran into:

>  devtools::build_site()
Caused by error in `file(con, "w")`:
! cannot open the connection
See `$stdout` and `$stderr` for standard output and error.
Type .Last.error to see the more details.
 1. devtools::build_site()
 2. withr::with_temp_libpaths(action = "prefix", code = { …
 3. base::force(code)
 4. withr::with_output_sink(file_temp(), pkgdown::build_site(pkg = pkg$path, …
 5. base::force(code)
 6. pkgdown::build_site(pkg = pkg$path, ...)
 7. pkgdown:::build_site_external(pkg = pkg, examples = examples, run_dont_run = run_dont_run, …
 8. callr::r(function(..., cli_colors, pkgdown_internet) { …
 9. callr:::get_result(output = out, options)
10. callr:::throw(callr_remote_error(remerr, output), parent = fix_msg(remerr[[3]]))
Subprocess backtrace:
 1. pkgdown::build_site(...)
 2. pkgdown:::build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, …
 3. pkgdown::init_site(pkg)
 4. pkgdown:::build_site_meta(pkg)
 5. pkgdown:::write_yaml(meta, path_meta)
 6. pkgdown:::write_lines(yaml::as.yaml(x), path = path)
 7. base::writeLines(enc2utf8(text), path, useBytes = TRUE)
 8. base::file(con, "w")
 9. base::.handleSimpleError(function (e) …
10. global h(simpleError(msg, call))

I'm not entirely sure what's going on here. I can confirm I have all dependencies - system, imports, and development - for using build_site(). I also know the library I wrote works fine on my Windows system and Ubuntu and the only imports are dplyr and lubridate. Deleting .Rproj.user did not work.

I expect to be running a server instance of Rstudio but was only running this on the terminal for the moment to see if it worked. I also expect to be running Ubuntu 22.04/20.04, Windows, and WSL2 at different times. I also expect to be working in these repositories with a small team across Arch and openSUSE in the future. Simply running all of these services in individual Docker containers is not an option in this circumstance, as much as I wish it were.

I guess my question is: for a newbie R package developer, what are some things I can do that consider a need to develop on multiple systems while seamlessly accessing the development environment? I might have missed a few things in the tutorials I read about devtools but everything else seemed to go fine?



options(error = recover)
pkgdown::buid_site(new_process = FALSE)

and then try to see why path is not writeable in pkgdown::write_lines().

1 Like

I was able to solve the issue with a different browser. It was ultimately a chrome-browser policy issue:

[0124/] :components/policy/core/common/ Skipping recommended platform policies because no policy file was found at: /etc/opt/chrome/policies/recommended      
[0124/] Floss manager not present, cannot set Floss enable/disable.                 
[0124/] InitializeSandbox() called with multiple threads in process gpu-process. 

When running with and without sudo:

> options(error = recover)
> pkgdown::build_site(new_process = FALSE)
-- Installing package into temporary library -----------------------------------
== Building pkgdown site =======================================================
Reading from: '/home/user/r_package/docs'
Writing to:   '/home/user/repos/r_package/docs'
-- Initialising site -----------------------------------------------------------
Error in file(con, "w") : cannot open the connection
In addition: Warning message:
In file(con, "w") :
  cannot open file '/home/user/repos/r_package/docs/pkgdown.yml': Permission denied

sudo R added this additional error for failing to start chrome even in --headless --no-sandbox

> [701:701:0124/] Running as root without --no-sandbox is not supported. See

I then installed the Brave binary and pkgdown::build_site(new_install = FALSE) worked fine. If chrome is installed, it defaults to chrome. It also did not honor my R_BROWSER. Uninstalling google-chrome worked and the build was then successful.

If there is a way to pass the argument for the browser used to build the docs in build_site(), I haven't been able to find what it might be. I'm guessing an xdg-setting or other similar variable, but this does the job for now.

The best approach for you will depend on your specific needs and requirements. If you are managing a small number of systems, you may be able to get away with using a package manager. However, if you are managing a large number of systems, you may need to use a configuration management tool.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.