extendr / extendr/extendr

fix: Unable to find default R packages when run under WSL

Open
#1,094 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
528
Forks
58
PR merge metrics
No merged PRs in 30d

Description

### Pre-flight checklist

- [x] I have searched existing issues and this is not a duplicate

### Expected behavior

My program to run.

### Current behavior

Upon launch, R crashes with the following message:

```text
dan@IPRC-PF4SK9MP:~/dev/reprecies/extendr-fail$ cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/extendr-fail`
program starts
.Rprofile only exists to prevent user-level .Rprofile from running.
Warning message:
package "methods" in options("defaultPackages") was not found
During startup - Warning messages:
1: package ‘datasets’ in options("defaultPackages") was not found
2: package ‘utils’ in options("defaultPackages") was not found
3: package ‘grDevices’ in options("defaultPackages") was not found
4: package ‘graphics’ in options("defaultPackages") was not found
5: package ‘stats’ in options("defaultPackages") was not found
6: package ‘methods’ in options("defaultPackages") was not found
Error in Ops.numeric_version(R_version_built_under, "4.0.0") :
there is no .Internal function 'compareNumericVersion'
Fatal error: unable to initialize the JIT
```

### Steps to reproduce

Initialize a new package:

`cargo init reprex .`

Add required packages:

`cargo add extendr-engine extendr-api`

Write a nice little `main.rs`:

```rust
use extendr_api::prelude::*;

fn main() {
println!("program starts");

extendr_engine::start_r();

println!("R has started");

let _ = R!("print(mtcars)");

println!("R should have produced output");
}
```

Compile and run:

`cargo run`

### Possible solution

I am encountering this on my work machine, running Debian under WSL2 on Win11; my personal machine, running the latest native Void Linux, does not have any problems. I suspect Windows, somehow.

### Environment

This issue isn't a _duplicate_, exactly, but someone else reported having this problem 2+ years ago, but then didn't provide _any_ helpful context or information ( #527 closed ). I commented with all of this there, but then I thought I should just open a new issue.

arch: x86_64 (13th Gen Intel(R) Core(TM) i7-1360P)

OS: WSL2 under Win11, using the special WSL2 version of Debian 12 (bookworm), kernel 6.6.114.1-microsoft-standard-WSL2.

system R: version 4.3.3

rustc: version 1.92.0 (and I triple-checked that I _am_ indeed using the right target triple, x86_64-unknown-linux-gnu)

I'm using bash 5.2.15, in case that matters.

***

Edited for typo.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.