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

Setup with conda installed R: attaching active Terminal fails #1487

Open
skwde opened this issue Feb 12, 2024 · 5 comments
Open

Setup with conda installed R: attaching active Terminal fails #1487

skwde opened this issue Feb 12, 2024 · 5 comments
Labels

Comments

@skwde
Copy link

skwde commented Feb 12, 2024

Describe the bug
conda installed packages are not found;
not possible to attach active terminal session.

To Reproduce

Use following environment file to install R

---
name: r
channels:
  - conda-forge
dependencies:
  - r-base
  - r-renv
  - r-languageserver
  - r-httpgd
  - radian

and run

conda create -f environment.yml

to install the environment.

Ensure the settings as mentioned below.

Next clikc on R: (not attached) in the status bar in VSCode and get the error

The terminal process "<path to base>/.conda/envs/r/bin/radian '--no-save', '--no-restore'" terminated with exit code: 1.

Can you fix this issue by yourself? (We appreciate the help)

No

(If applicable) Please attach setting.json

"r.rpath.linux": "<path to base>/.conda/envs/r/bin/R",
"r.rterm.linux": "<path to base>/.conda/envs/r/bin/radian",

"r.libPaths": ["<path to base>/.conda/envs/r/lib/R/library"],

Expected behavior
Terminal should attach

Screenshots
If applicable, add screenshots to help explain your problem.
You can show the keyboard contents by pressing F1 and Developer: toggle screencast mode

Environment (please complete the following information):

  • OS: macOS 14.2.1 with vscode server on rocky 8.6
  • VSCode Version:1.86.1
  • R Version: 4.3.2
  • vscode-R version: v2.8.2

Additional context
I already tried what is suggested here https://github.com/REditorSupport/vscode-R/wiki/R-Session-watcher#advanced-usage-for-self-managed-r-sessions as mentioned in this issue

EDIT:

There are also following related issues

@skwde skwde added the bug label Feb 12, 2024
@rfhb
Copy link

rfhb commented Feb 18, 2024

The system call to radian wrongly includes a comma after the first parameter:

"<omitted>/bin/radian '--no-save', '--no-restore'"

This seems unrelated to using conda or not, in my case without conda. I did not readily find the reason for why the system call is composed like this.

@skwde This worked for me to fix:

  • In VS Code, open setting r.rterm.option
  • Remove parameters and re-add parameters, one by one, --no-save and --no-restore
  • Open Terminal pane, add R Terminal

Subsequently, radian started for me as expected:

ps ax | grep radian
52731 s014  Ss+    0:01.91 <omitted>/MacOS/Python /usr/local/bin/radian --no-save --no-restore

@skwde
Copy link
Author

skwde commented Mar 4, 2024

@rfhb thanks for the suggestion but this doesn't solve the problem.

I tried re-adding as you suggested but the problem keeps reappearing.
I also tried

"r.rterm.option": [
        "--no-save --no-restore"
    ],

Then I get

The terminal process "<path to base>/.conda/envs/r/bin/radian '--no-save --no-restore'" terminated with exit code: 2.

It looks like the problem is that the parameters are included inside ''.

It actually also fails when I set

"r.rterm.option": [],
The terminal process "<path to base>/.conda/envs/r/bin/radian" terminated with exit code: 1.

@botsunny
Copy link

Hey there, did you find a solution to your problem?

@skwde
Copy link
Author

skwde commented Mar 27, 2024

@botsunny Unfortunately no...

@jondeans
Copy link

jondeans commented Apr 12, 2024

I have nearly the same environment set up and the same issue.

It's odd because running radian --no-save --no-restore from the CLI works fine and you can reproduce the same errors manually by adding in the quotes radian '--no-save --no-restore' or radian '--no-save', '--no-restore'

Setting r.bracketedPaste: true like the install instructions doesn't seem to work either.

{
  "r.bracketedPaste": true,
  "r.rterm.linux": "/home/user/.local/bin/radian"
}

My hunch is that if the options from the r.term.option list could be passed differently this would all go away, but I'm not familiar enough with VS Code extensions to attempt that fix here.

However!

Adding your R binary to the options list does seem to work for now.

{
    "r.rpath.linux": "/home/ec2-user/miniconda3/envs/ngs/bin/R",
    "r.rterm.linux": "/home/ec2-user/miniconda3/envs/ngs/bin/radian",
    "r.rterm.option": [
        "--no-save",
        "--no-restore",
        "--r-binary=/home/ec2-user/miniconda3/envs/ngs/bin/R"
    ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants