VSCode-R-Debugger: 'R path not working: /usr/local/bin/R (Can be changed in setting r.rpath.XXX)'
Description R Debugger doesn’t see the R executable, even though the correct R path has been given?
To Reproduce
- Install the prerequisites (R, VSCode, the R extension for VSCode)
- Install R Debugger, along with dependencies
- Create a new folder, with a simple R file, test.R, with something like below
- Try to run said code
Your R code
test.R
print(hello world')
a <- 2 + 2
Your Launch config If applicable, the launch config that causes the bug. E.g.:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "R-Debugger",
"name": "Launch R-Workspace",
"request": "launch",
"debugMode": "workspace",
"workingDirectory": "${workspaceFolder}"
},
{
"type": "R-Debugger",
"name": "Debug R-File",
"request": "launch",
"debugMode": "file",
"workingDirectory": "${workspaceFolder}",
"file": "${file}"
},
{
"type": "R-Debugger",
"name": "Debug R-Function",
"request": "launch",
"debugMode": "function",
"workingDirectory": "${workspaceFolder}",
"file": "${file}",
"mainFunction": "main",
"allowGlobalDebugging": false
},
{
"type": "R-Debugger",
"name": "Debug R-Package",
"request": "launch",
"debugMode": "workspace",
"workingDirectory": "${workspaceFolder}",
"includePackageScopes": true,
"loadPackages": [
"."
]
},
{
"type": "R-Debugger",
"request": "attach",
"name": "Attach to R process",
"splitOverwrittenOutput": true
}
]
}
Expected behavior Run
Actual behavior Throws an error
Desktop (please complete the following information):
- OS: Mac OS 12.0 (M1 based)
- R Version: R version 4.1.2 (2021-11-01) – “Bird Hippie”
- vscDebugger Version: vscDebugger_0.4.7
- vscode-r-debugger Version: v0.4.7
Additional context I’m new to VS Code, coming from RStudio, so I may have messed something up here, however, I’ve tried installing it three times now (reinstalling VSCode, with no luck!). Don’t know what I’m doing wrong.
The path to R is the one in the title, I’ve double checked! I’ve added the path to both the rterm and rpath options in settings, and it doesn’t work, nor does removing both. VS Code can see the R binary for the terminal, but the debugger seemingly cannot see it
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 27 (3 by maintainers)
Yeah, that was the missing link 😃 So, following @eitsupi and using the current R patches from https://mac.r-project.org/ should finally solve the initial issue!
Good and bad news so far: The above issue that R ignores input from stdin when the --interactive flag is set, is still fixed in newer versions of R. You could find these patches (including installer packages) here: https://mac.r-project.org
However, after the installation I got some new problems concerning the R-package “vscDebugger”, which is necessary for debugging. Up to now, this package is not supported by newer R versions. So the installation via install.packages(“vscDebugger”) results in an error:
I think we have to wait until the next official version of R is released…
I have the same issue.
@eitsupi Sorry, I didn’t mention I was referring to the build for the macOS M1 chip. I guess this issue is specific for the macOS M1 arm64 build instead of all arm64 builds.
Also, it seems macOS takes the strings (with escaping) in a different way.
I am using zsh with echo, and it can correctly feed this line to the R console without any warning like
Error: unexpected '\\' in "base::cat('Hello\\n')\"Maybe the R start up takes unusually long? You can change the config
"r.debugger.timeouts.startup": 2000to wait longer for R to get ready.