vscode-R
vscode-R copied to clipboard
Setup with conda installed R: attaching active Terminal fails
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
- https://github.com/REditorSupport/vscode-R/issues/1094.
EDIT:
There are also following related issues
- https://github.com/randy3k/radian/issues/341
- https://github.com/randy3k/radian/issues/372
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-saveand--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
@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.
Hey there, did you find a solution to your problem?
@botsunny Unfortunately no...
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"
]
}