vscode-R icon indicating copy to clipboard operation
vscode-R copied to clipboard

Gotcha for people with `conda`

Open nickeubank opened this issue 3 years ago • 7 comments

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:

image

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.

nickeubank avatar Jun 30 '21 13:06 nickeubank

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.

renkun-ken avatar Jun 30 '21 13:06 renkun-ken

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.)

nickeubank avatar Jun 30 '21 13:06 nickeubank

Hello. What are the best practices for setting R_HOME in windows?

CWen001 avatar Feb 19 '22 07:02 CWen001

This issue is stale because it has been open for 365 days with no activity.

github-actions[bot] avatar Feb 20 '23 02:02 github-actions[bot]

unstale

ElianHugh avatar Feb 20 '23 02:02 ElianHugh

This issue is stale because it has been open for 365 days with no activity.

github-actions[bot] avatar Feb 22 '24 01:02 github-actions[bot]

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.

ChristofKaufmann avatar Apr 09 '24 10:04 ChristofKaufmann