randy3k / radian

A 21 century R console
MIT License
1.97k stars 73 forks source link

[Radian in VS Code] Cannot find R client (i.e. radian) #372

Open xiapingz opened 1 year ago

xiapingz commented 1 year ago

Hi guys,

I am using VS code for R in a remote UNIX environment. I was trying to use radian as a default R terminal thru the following settings.

image

However, I kept getting this error message below.

Screen Shot 2022-07-22 at 12 22 41 PM

"radian" is installed within the conda environment, 'r'. But somehow vs code couldn't locate it.

Does anyone have any clues? Thanks a lot!

randy3k commented 1 year ago

I think you might need to activate the conda environment. It is prone to error anyway, if you install R within an conda environment. I suggest you install radian in a global environment.

xiapingz commented 1 year ago

I think you might need to activate the conda environment. It is prone to error anyway, if you install R within an conda environment. I suggest you install radian in a global environment.

Thanks for your reply, @randy3k ! I am on a slurm cluster. I tried installing radian within the global environment (using the system default python and R). But the installation was redirected as message shows:

Defaulting to user installation because normal site-packages is not writeable

So the radian executive is at

/home/usr/.local/bin/radian

which is still not able to be launched.

The error message from VS Code is

The terminal process "/home/usr/.local/bin/radian '--no-save', '--no-restore'" failed to launch (exit code: 1).

Any ideas on it?

Best, X.

MiguelRodo commented 1 year ago

I had the same problem even when not using miniconda and using pip when installing radian for just the user, despite setting r.rterm.linux to the user-specific radian package (and despite running /home/usr/.local/bin/radian in the terminal working). Installing radian system-wide worked, though, but obviously not an option on the HPC (well, the sysadmin could).

If you search for r.rterm.linux in this repo's issues, you get the following issues that seem related: #341 and #334.

I don't have in-depth knowledge at all of this situation, but it seems like the R extension for VSC is ignoring r.rterm.linux. If that's true, then this isn't a radian issue.

randy3k commented 1 year ago

@xiapingz What errors do you see when you run /home/usr/.local/bin/radian in the terminal.

xiapingz commented 1 year ago

@xiapingz What errors do you see when you run /home/usr/.local/bin/radian in the terminal.

Hi @randy3k , if I simply run /home/usr/.local/bin/radian in the terminal, the radian will prompt out normally. The issue is that it couldn't be attached to VS Code's R workspace.

xiapingz commented 1 year ago

I had the same problem even when not using miniconda and using pip when installing radian for just the user, despite setting r.rterm.linux to the user-specific radian package (and despite running /home/usr/.local/bin/radian in the terminal working). Installing radian system-wide worked, though, but obviously not an option on the HPC (well, the sysadmin could).

If you search for r.rterm.linux in this repo's issues, you get the following issues that seem related: #341 and #334.

I don't have in-depth knowledge at all of this situation, but it seems like the R extension for VSC is ignoring r.rterm.linux. If that's true, then this isn't a radian issue.

Hi @MiguelRodo , if I set r.rterm.linux as my system R executive, it works perfectly, and while radian doesn't. If you are on HPC, before running any R codes, did you activate your system wide R, using something like module load R?

MiguelRodo commented 1 year ago

Hi @xiapingz - interesting to know! I hadn't tried r.rterm.linux as system-wide R.

On the HPC, I just used a singularity container and didn't use the VSC R extension, so this issue only arose for me in WSL. But since I'm admin, I just installed radian system-wide.

WhySeeYC commented 1 year ago

I did exactly what @MiguelRodo did installing radian system-wide with pip3. And when I run which radian , it shows /usr/local/bin/radian . I tried to set this as the workspace setting "r.path" in vs code and the same error message showed The terminal process "/home/usr/local/bin/radian '--no-save', '--no-restore'" failed to launch (exit code: 1).

May I ask is there a way to change where radian is installed? I saw tutorials from previous experts, the path seems to need to look like /Library/Frameworks/Python.framework/Versions/3.10/bin/radian Appreciated if this can be solved, thanks a lot.

I am running on a MacOS 12.6 Python version 3.10 VS code version 1.72.1

psobolewskiPhD commented 1 year ago

@WhySeeYC Can you confirm that you can launch radian fine from the terminal and it runs properly? Also in VS Code settings, it's r.rterm.mac that needs to point to the radian binary. This is what is launched in vscode. And you need to ensure that you have the bracketedPaste checked/True. r.rpath.mac needs to point to your actual R binary (which R)

WhySeeYC commented 1 year ago

@psobolewskiPhD Thank you 😃. And yes, I can confirm that when running radian in the terminal (without user setting), radian can run properly. However, if I were to write script in the editor and execute them with cmd return , the default R interactive window will be used by vs code.

I set the r.rpath.mac with result fromwhich R, and r.rterm.mac with result from which radian , and the error message showed The terminal process "/home/usr/local/bin/radian '--no-save', '--no-restore'" failed to launch (exit code: 1). Really appreciate some help 🙏🏻

psobolewskiPhD commented 1 year ago

Hmm, that error is suggesting that vscode is looking for radian in /home/usr/local/bin/radian so maybe you have some duplicated settings? You can use the View > Command Palette > to do: Preferences: Open User Settings (JSON) This will open the actual file where your settings are stored. You can double check that there's no duplicate entries for those above. Also make sure you have "r.bracketedPaste": true,

WhySeeYC commented 1 year ago

@psobolewskiPhD thank you again. Yes I double checked the settings.json file and there were only one set of settings. I tried to uninstall and re-install radian and the terminal message printed that the requirement already satisfied(as below). do you think it could be because there are multiple radian installed?

Collecting radian
  Using cached radian-0.6.4-py3-none-any.whl
Requirement already satisfied: rchitect<0.4.0,>=0.3.39 in /usr/local/lib/python3.10/site-packages (from radian) (0.3.39)
Requirement already satisfied: pygments>=2.5.0 in ./Library/Python/3.10/lib/python/site-packages (from radian) (2.13.0)
Requirement already satisfied: prompt-toolkit<3.1,>=3.0.15 in ./Library/Python/3.10/lib/python/site-packages (from radian) (3.0.31)
Requirement already satisfied: wcwidth in ./Library/Python/3.10/lib/python/site-packages (from prompt-toolkit<3.1,>=3.0.15->radian) (0.2.5)
Requirement already satisfied: cffi>=1.10.0 in /usr/local/lib/python3.10/site-packages (from rchitect<0.4.0,>=0.3.39->radian) (1.15.1)
Requirement already satisfied: six>=1.9.0 in ./Library/Python/3.10/lib/python/site-packages (from rchitect<0.4.0,>=0.3.39->radian) (1.16.0)
Requirement already satisfied: pycparser in /usr/local/lib/python3.10/site-packages (from cffi>=1.10.0->rchitect<0.4.0,>=0.3.39->radian) (2.21)
Installing collected packages: radian
Successfully installed radian-0.6.4

P.S. I also double checked the VS Code-R Extension's suggestion on radian installation for mac and it does seem that the usual which radian path is /usr/local/bin/radian

psobolewskiPhD commented 1 year ago

Those messages are telling you that things that radian requires are already present, which makes sense because you had radian installed already. If which radian works and you can launch radian from the Terminal by just typing radian then the install is fine and it's an issue with the VS Code settings.

Maybe to sanity check, type alias in your Terminal to make sure you don't have some alias changing something? and maybe try: ls -al /usr/local/bin/radian and ls -al /home/usr/local/bin/radian

WhySeeYC commented 1 year ago

Thank you so much @psobolewskiPhD, I check the alias with the first command ls -al /usr/local/bin/radian and it returns -rwxr-xr-x 1 myusername admin 230 20 Oct 10:15 /usr/local/bin/radian, I believe this means that I only have one set of radian that is installed in this path /usr/local/bin/radian. Is that correct? 🙏🏻 Super grateful for all the help, will continue finding solutions for the vs code setting. If there is a solution, please also let me know 🙏🏻

psobolewskiPhD commented 1 year ago

Yes, your ls -al /usr/local/bin/radian output is correct, showing that radian binary is there and executable. Are you still getting the same error from VS Code about /home/usr/... If so, can you post the output of: ls -al /home/usr/local/bin/radian

WhySeeYC commented 1 year ago

@psobolewskiPhD thanks and yes, so the output of ls -al /home/usr/local/bin/radian is ls: /home/usr/local/bin/radian: No such file or directory. I can confirmed that the vs code terminal out put is still the same as the exit code 1: The terminal process "/usr/local/bin/radian '--no-save', '--no-restore'" terminated with exit code: 1. This was with vscode settings:

 "r.rpath.mac": "/usr/local/bin/R",
 "r.rterm.mac": "/usr/local/bin/radian"
psobolewskiPhD commented 1 year ago

@WhySeeYC Can you look at that JSON again and search for rterm.option? Here's what I have:

"r.rterm.option": [
        "--no-save",
        "--no-restore",
        "--r-binary=/usr/local/bin/R"
    ],

I suspect that the last line there --r-binary is either missing or not set properly to point to your R install.

WhySeeYC commented 1 year ago

Hi @psobolewskiPhD Thank you so much!!!! so I did not have the "--r-binary=/usr/local/bin/R" as the option and I set it up, it works fine now 🎉 Thank you so so much! so the current setting is

 "r.rpath.mac": "/usr/local/bin/R",
    "r.rterm.mac": "/usr/local/bin/radian",
    "r.rterm.option": [
        "--no-save",
        "--no-restore",
        "--r-binary=/usr/local/bin/R"]
psobolewskiPhD commented 1 year ago

Awesome! Glad we got it sorted. Sorry it took so long! BTW You'll want to have "r.bracketedPaste": true, also if you don't already.

WhySeeYC commented 1 year ago

@psobolewskiPhD thank you for reminding, just added that now. May I ask what does the --no-save, --no-restore, and --r-binary = /usr/local/bin/R imply? Thank you 🙏🏻

psobolewskiPhD commented 1 year ago

May I ask what does the --no-save, --no-restore, and --r-binary = /usr/local/bin/R imply? Thank you

I have no idea 🤣 Perhaps a better question for the vscode-r repo?

LulinS commented 1 year ago

@psobolewskiPhD Thank you so much! Your suggestion also helped me. I spent tons of time to figure out the issue!

chrisoswald commented 11 months ago

I had also th problem with "cannot find R client". I have radian installed on ~/.local/bin/radian and it was not found. I have changed the path of rterm in vscode in /home/user/.local/bin/radian and it's running.

Yiminnn commented 1 month ago

finally got solution, error message pop up real quick said can't determine r home, I added "r.rterm.option": ["--r-binary=/home/xxx/miniconda3/bin/R"], and finally worked

kunkun1qaz commented 1 week ago

I also have this problem. But I am working on windows.
image here's my rterm option image I have changed it but it still doesn't function