-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
precommit environment cannot be set up #476
Comments
|
I tried with R 4.2 and precommit still fails. However, when I try
But I don't see this error in v4.3.0 - {assertr} can be installed successfully. So I think it is as you say: the binary for {assertr} for R 4.2 is not compatible with R 4.3.
I'm unclear on what If indeed the problem is that the current |
With If this already fails at |
Thanks for the explanation. After cloning {precommit}, I am able to run I did see a warning that the lockfile was out of date before restoring, but ignored it. FYI I frequently encounter warnings like this:
|
Ok. Yes, these warnings were expected. Some test files are not parsable on purpose (to test functions). I suggest you |
Sorry, can you clarify what you mean by "purge the assertr package with {renv} from anywhere"? The package where I want to use precommit does not have a renv.lock file (does not use renv) so I can't "purge" it. |
|
|
I have the same behavior with 4.3.0
This is the log file. |
The problem in my config is this chunk, generated by
I removed it, and precommit is working again. |
I can confirm that removing the @lorenzwalthert do you mind explaining why you need to install all of the package dependencies in the precommit renv environment? |
they need to be installed because running roxygen requires |
I don't know if the problem is alwo that MRAN has no binaries built for 4.3 and since it will retire soon, maybe they don't plan to do so in the future at all. May be an issue for {renv} in general, see rstudio/renv#1179. |
So I guess a reasonable work-around for now is to turn off the |
My above suggestions:
attempt to commit. If does not work, yes, then you can de-activate the hook by commenting the id of the hook out in |
I appear to be having a similar issue, albeit not related to the package I've attached the pre-commit log below: The precommit yaml I am using is:
To reproduce
Additional context
|
@RHReynolds can you folllow the instructions I put in the Wiki to deal with these kinds of errors and tell me if this helped to resolve the problem? Another option is that maybe the combination options(install.packages.compile.from.source = "never", pkgType = "binary") is not working well with package manager, as the URL that is produced seems invalid:
Maybe I'll file an issue in {renv} to see if the source is there. In the meantime, you can also update to {renv} 1.0.0. |
Also note that it seems like binary packages are now provided on the public Posit Package Manager also for macOS, so all major platfroms are supported. This might alleviate or solve the problem. |
I'm not sure I understand the issue completely, but right now I'm having the following problem (which looks related to the ones above) when running the
If I understood the comments correctly, adding I see 2 big issues that prevents me from using this hook in any of the packages I work with, which is a shame:
Is this really how the hook works or am I missing something else? |
yes, for the roxygenise hook as it is implemented now, this is the way to go. We might create a new hook in the future that relies on your global R library to avoid this (#494).
Your package must be installable through |
I use renv, so my R library isn't global, but local to the package. Which also means that the library loaded by
How do you setup anything before startup if In fact the hook could easily detect the presence of an |
Yes, in that case, renv should be used by that hook.
If you already have these packages installed and they are in your renv cache, then yes, that cache would be used and auth would not be a problem. You can even go so far and say fine, if the packages can't be installed, then you just have to install them manually interactively first and then rely on the cache. |
There is some confusion here because there are two different The private repositories in this case have no authentication but are only accessible from within certain networks.
The hooks also run on the CI (in case someone doesn't install |
Ok, yes, you are right, my bad.
Ok, then this is not an option yes. If you want to contribute to #494, you are most welcome. It would actually be mostly identical to the existing hook, maybe we can factor the script at |
I have a solution for anyone who experiences issues with I noticed that I asked my teammates to check their package type settings, and I have noticed a pattern where a homebrew R installation had these values set to I hope this helps someone. |
@TymekDev thanks for the hints. You are making the right connections. The goal was to enable fast binary installs on all platforms, so we tickered with these options as by default, it seemed as sometimes source installations were attempted. Some of these failed because the required built-time dependencies were missing on local computers (e.g. make). I have eliminated one dependency that would be problematic in this repo with #497. So maybe, we should not require binaries anymore.
Can you pin it down if it's a {renv} issue or a base R issue? What does the URL look like?
|
Hi @lorenzwalthert I'm having the exact same problem as mentioned before, on a Apple M1 Pro. I am having a problem with the Content of
Output of running the precommit hook:
I'm not sure why In any case, a quick fix for now has been to fork this repo (here) change the repository URL in the |
It seems like rstan is not available as a binary from PPM for macOS according to https://packagemanager.posit.co/client/#/repos/cran/packages/rstan/631497/overview?search=rstan%23package-details Hence, renv seems to fallback on MRAN, which does not have the package either. |
I think the workaround would be to install the package outside of pre-commit (actually anywhere, you can try in your R console with To ensure that actually works, can you first |
Thanks for reaching out so quick. After uninstalling and purging rstan from R and changing back to the repo, I do indeed get the same error as before. After some debugging, I figured out that the version of
The newest version of |
Great. You can also pin the version in |
Let's close this. Anyone who finds new problems please open a new issue, it's already pretty convoluted. |
Before filing a bug
remotes::install_github('lorenzwalthert/precommit')
precommit::autoupdate()
)I am getting the following error when I try to make a commit using precommit and R v4.3.0:
version information
error information
To Reproduce
I am using
precommit
in this repo: https://github.com/joelnitta/dwctaxonClone the repo, set up precommit, then try making a commit.
Expected behavior
A clear and concise description of what you expected to happen.
No error
Additional context
packageVersion('renv')
: 0.17.3The text was updated successfully, but these errors were encountered: