REditorSupport / vscode-R

R Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=REditorSupport.r
MIT License
1.07k stars 128 forks source link

Vscode R LSP cannot work with a R installed in conda env #1555

Open littlemingone opened 2 months ago

littlemingone commented 2 months ago

Hello guys. I am using Vscode to work on R language for some data analyses. The r-base was installed in a conda environment. And I found that the R terminal cannot work with barely configuration of r.path.xx and r.term.xx pointing to the R.exe in conda env. But with the Python Addon, I can activate a conda env before I start a R terminal.

The R interperter itself can work prefectly after I Python: Select Interperter to configure which conda env to be use. But I found that the R Language Server seem to work independently and doesn’t influenced by the Python: Select Interperter. As the result, the R LSP launched without activating correct conda env and the R launched failed due to missing dll files. How can I launch the R LSP in a conda env?

By the way, I found that an r-base installed by conda cannot work without activating its conda env but a R installed by the CRAN R installer can be use at anywhere. It works even copy the whole directory to another PC. What makes this diffrence and can I make the conda r-base work in such a standalone mode?

ShuguangSun commented 2 months ago

It requires the dynamic (dll/so) of libblas, liblapack etc. shipped with conda in the system PATH, or can be found in some way.

littlemingone commented 2 months ago

It requires the dynamic (dll/so) of libblas, liblapack etc. shipped with conda in the system PATH, or can be found in some way.

OK, it works, thank you!

But I still find it a bit wired that in order to use a conda environment I need to write its path in the PATH instead of activating it somehow.