-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Executable Rscript
not found in VS Code
#543
Comments
Thanks for the report. Is |
Also see #441 (comment). |
I honestly don't know how to tell if If I run
And here's what I get if I run
If it's helpful, here are two VS code settings I've manually configured: "r.rterm.windows": "C:\\Users\\persij\\AppData\\Local\\Programs\\R\\R-4.3.1\\bin\\x64\\R.exe",
"r.rpath.windows": "C:\\Users\\persij\\AppData\\Local\\Programs\\R\\R-4.3.1", I tried to set the path environment in VS code to be the same as the one in RStudio but to no avail. Please let me know if there's anything else I can do to help! |
Ok finding out how |
Thanks for your patience - I now appreciate this isn't a precommit issue. I'll look into it a bit more on my own. Thanks for your help! |
I think if you use VS Code and a reasonable recent version of macOS, then your default shell is zsh (and there should be no difference to opening a new zsh shell with the Apple terminal app) and you can add the location of your R executable to the Or you just install R again with an installation method that places the executable on the |
@lorenzwalthert I have the same issue, I basically use two different To my understanding pre-commit will fetch what is needed on |
Ok. I don't think I accounted for the situation where you don’t have a global R executable but instead only one in a conda environment. In fact, I think this would require a change to the python pre-commit package because when you call git to commit, git calls pre-commit which calls Rscript on the PATH to activate renv to call the hooks. Temporary workaround is to have a global R installation you can fall back on that is on the PATH. |
How can you reliably detect if a directory uses a conda environment? And how to find the R executable? |
Ok, the availability of So in that case it would be enough to look for Regarding your question, does this https://pre-commit.com/#conda help? |
In pre-commit, there are different levels of languages,
Usually though, pre-commit is installed globally (at least I haven't come across a project where pre-commit was listed as a dev requirement), and there is not necessarily a pre-commit conda or venv virtual environment associated with it. Also note that for example in R, the {renv} environment that pre-commit uses is not same as the user created for his project (if any), but these are separate virtual environments. While most R projects don't use {renv}, some do, and pre-commit's {renv} environment is separate from it. So if you are using conda to manage your project's dependencies, it does not mean that pre-commit has to use conda as well. In fact if you install {precommit} into your conda environment, it is only useful as far as the R API goes, e.g. to
If this repository's hooks were implemented with Summa summarum, I think the easiest is just to install R globally so you can use it for pre-commit. Using the hooks from this repo won't install any packages in your global R package library, except maybe {renv}. |
Before filing a bug
remotes::install_github('lorenzwalthert/precommit')
precommit::autoupdate()
)Describe the bug
I am able to use the precommit package successfully in RStudio but if I try to use precommit (on the same computer) in VS code, I receive errors like:
To Reproduce
Steps to reproduce the behavior:
precommit::use_precommit()
Expected behavior
I expect precommit's checks to run on VS
Additional context
packageVersion('renv')
The text was updated successfully, but these errors were encountered: