-
-
Notifications
You must be signed in to change notification settings - Fork 48
Packages are not found after R upgrade
Lorenz Walthert edited this page May 19, 2024
·
11 revisions
For example if you see
Error in loadNamespace(x) : there is no package called ‘docopt’
Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
After an R minor or major upgrade, pre-commit may wants to use old and incompatible binaries / installed packages.
You need to destroy the invalid links and let pre-commit link these again with the correct version.
- run
pre-commit clean
to delete the pre-commit cache. - run
pre-commit install --install-hooks
- try to commit again.
- if it fails, remove offending package with version from {renv} cache. E.g. for the above, run
renv::purge('docopt')
(does not matter from which working directory and if a renv is activated) and confirm the prompt. You may later have to do that again if other packages are not found. Then, install the package manually with renv (so it's added to the cache) withrenv::install('docopt')
. - try to commit again.