Open skwde opened 9 months ago
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:
r.rterm.option
--no-save
and --no-restore
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"
]
}
I hope this helps you guys.
A solution that I found was to work with conda + vscode + renv.
Each project that I work on has its own conda environments (stored at conda_envs
), including one called r
. I use renv to track and manage my R libraries. This is a bit different from managing your R libraries within conda. I work project-based, so each time I connect to a project, I open the VSCode in the project folder. I tell vscode to look for R in the project, so it always attaches the R of the project. Radian does not work (I have not tested it extensively though).
This is a reproducible set-up:
project/
, I have the r.yml
file:name: conda_envs/r
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- r-base=4.1.2
prefix: conda_envs/r
conda env create --prefix conda_envs/r -f r.yml
conda activate conda_envs/r
# Install packages using renv
# If you have conda_envs in .gitignore, do not need to do it.
echo "conda_envs" > .renvignore
R -e 'install.packages(c("renv"), repos = "http://cran.us.r-project.org")'
R -e 'renv::init()'
R -e 'renv::install(c("languageserver", "httpgd", "jsonlite", "rlang"))' # libs necessary for vscode
{
"r.plot.useHttpgd": true,
"r.rpath.linux": "${workspaceFolder}/conda_envs/r/bin/R",
"r.rterm.linux": "${workspaceFolder}/conda_envs/r/bin/R" // radian will not work
}
Go to the folder as base directory: File --> Open Folder...
Open a new R terminal (I normally go to + on terminal tab and select R terminal
Still trying to figure out how to get radian working in this setup. I think the trick is to tell radian which R to use, for instance $ env R_HOME=/usr/local/lib/R radian
. But I could not find a solution for my case where each project has its own R version.
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
and run
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 errorCan you fix this issue by yourself? (We appreciate the help)
No
(If applicable) Please attach
setting.json
Expected behavior Terminal should attach
Screenshots If applicable, add screenshots to help explain your problem. You can show the keyboard contents by pressing
F1
andDeveloper: toggle screencast mode
Environment (please complete the following information):
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