vscode-R
vscode-R copied to clipboard
Gotcha for people with `conda`
I recently discovered a bug that occurs for people with conda installations using radian
-- if one has conda
installed for python packages, VS code actively recommends using the "terminal.integrated.inheritEnv": false
setting (it has a popup, then adds if you click yes).
BUT
that results in vscode-R not being able to find RHOME, and so if I launch radian, I get this error (it just flashes up for a moment -- had to screen record to see it -- they terminal closes, and I get a The terminal process "/Users/Nick/miniconda3/bin/radian" terminated with exit code: 1. popup:
I set my R_HOME var in both zsh and bash profiles, and if I open a zsh terminal in VSCode, radian works, and if I open a bash terminal in VSCode, radian works. It's only when it's launched by trying to run an R file that I have a problem.
Adding this to settings:
"terminal.integrated.env.osx": {
"R_HOME": "/Library/Frameworks/R.framework/Resources/"
}
(based on advice in #431) fixes the problem.
I think it is caused by that we don't start R term from a shell so that the shell profile will not be sourced.
OK -- but if I turn off that one inheritEnv setting, it works fine without an explicit R_HOME
declaration in the settings. So I think it's tied to that setting some how.
(And because vscode actively suggests it for conda users, I think you may find a lot of users getting into trouble with it.)
Hello. What are the best practices for setting R_HOME in windows?
This issue is stale because it has been open for 365 days with no activity.
unstale
This issue is stale because it has been open for 365 days with no activity.
For an R installation in linux using a conda environment named r
the settings.json
file would include:
"terminal.integrated.env.linux": {
"R_HOME": "/PATH/TO/CONDA/envs/r/lib/R"
}
Radian looks inside this directory for lib/libR.so
.