R "ERROR: dependencies ... are not available" in CI
R tried to install a package but one or more of its Imports/Depends could not be obtained, so it aborts. The named dependencies are missing from the configured repositories or themselves failed to install.
What this error means
install.packages stops with "ERROR: dependencies 'A', 'B' are not available for package 'C'" and leaves the target package uninstalled.
ERROR: dependencies 'sp', 'units' are not available for package 'sf'
* removing '/usr/lib/R/site-library/sf'Common causes
Dependencies are not installed and dependencies=FALSE
Installing without resolving dependencies, or from a repo that lacks them, leaves the named packages absent so the build cannot proceed.
A dependency itself failed to build
A required package failed its own source build (a missing system library), so R reports it as not available to dependents.
How to fix it
Install with dependencies resolved
- Call install.packages with dependencies enabled so Imports and Depends are pulled in.
- Point at a CRAN mirror that publishes the dependencies.
- Re-run and confirm the named packages now install first.
Rscript -e 'install.packages("sf", dependencies=TRUE, repos="https://cloud.r-project.org")'Fix the underlying dependency build
If a dependency fails to compile, install its system libraries first so it builds and becomes available.
sudo apt-get install -y libudunits2-dev libgdal-devHow to prevent it
- Use
dependencies=TRUEso transitive packages are installed. - Install system libraries that native dependencies require.
- Pin a CRAN snapshot so the dependency set is stable.