ropensci / rix

Reproducible development environments for R with Nix
https://docs.ropensci.org/rix/
GNU General Public License v3.0
136 stars 12 forks source link

Something odd with RCDT, callr and nix #329

Closed HVinther closed 3 hours ago

HVinther commented 4 hours ago

So I've encountered a problem and not sure whether this is a problem of rix, a packing issue of nix or a problem with the packages themselves.

I've got the following file for generating the nix-enviroment. I've tried with r_ver as "4.4.0" and "bleeding edge"

rix::rix(
  r_ver = "bleeding_edge",
  r_pkgs = c("targets","RCDT"),
  ide = "code",
  overwrite = TRUE,
  print = TRUE
)

And the following _targets.R file

library(targets)

tar_option_set(
  packages = c("RCDT")
)

list(
  tar_target(name = "test",command = version)
)

When running targets::tar_make() inside the nix shell I get the following error message

Error in `get_result(output = out, options)`:
! callr subprocess failed: could not start R, exited with non-zero status, has crashed or was killed
ℹ See `$stderr` for standard error.

However, when running targets::tar_make(callr_function = NULL) the pipeline executes as expected. When I call

callr::r(\(x){version},package = "RCDT")

It does yield the above error message along with a warning, which also appears if I call library("RCDT") from within an ide (here positron). Calling library("RCDT") from within an ide I do however not get an error.

Warning message:
input string '  author = {Stéphane Dray and Anne-Béatrice Dufour and Jean Thioulouse and Thibaut Jombart and Sandrine Pavoine and Jean R. Lobry and Sébastien Ollier and Aurélie Siberchicot and Daniel Chessel},' cannot be translated from 'ANSI_X3.4-1968' to UTF-8, but is valid UTF-8 

When calling library("RCDT") from a terminal R-session I get prompted with

Selection:

Entering a number causes a segmentation fault. But entering a string just gives the prompt again.

Now, none of these problems arise in a rocker/r2u docker container. Calling library("RCDT") just loads the package with out error or warning in both an IDE and terminal.

I see that in the default.nix file created by rix, there are som LANG arguments in the pkgs.mkshell function, and since the warning mentions something about ANSI and UTF-8, I was wandering whether there might be an issue there.

I'm still quite new to nix, so I'm not quite sure yet how to determine if this is a problem with the nix packaging of RCDT or something else. Please redirect me, if you think the issue is better raised elsewhere.

HVinther commented 3 hours ago

Ok, I just created a temporary enviroment with:

nix-shell -p R rPackages.callr rPackages.RCDT

Where the issue persisted. I'll report this on NixOS/nixpkgs instead.

b-rodrigues commented 3 hours ago

Thanks, we also contribute to the R packages ecosystem on nixpkgs, so feel free to reference this issue in the one you’re going to open!