Not able to install tidyverse, error message ! Could not solve package dependencies

Good evening,
could someone please help me with the following error message? I uninstalled my older version and installed the R.4.5.0-win and also RStudio-2025.05.1-513 today. I am not able to install the package tidyverse and I am kind of stuck, after reading the previous threads on this topic this is what I tried:

options(repos = c(CRAN = "https://cran.r-project.org"))

install.packages("pak", repos = sprintf(
"https://r-lib.github.io/p/pak/stable/%s/%s/%s",
.Platform$pkgType,
R.Version()$os,
R.Version()$arch
))

#this seems to be successful, I see this:
Content type 'application/zip' length 13491449 bytes (12.9 MB)
downloaded 12.9 MB

The downloaded binary packages are in
C:\Users\Aneta Ritz-Radlinska\AppData\Local\Temp\RtmpmQvoPw\downloaded_packages

#then I tried

pak::pkg_install("tidyverse")

v Loading metadata database ... done
Error:
! error in pak subprocess
Caused by error:
! Could not solve package dependencies:

  • tidyverse: dependency conflict
  • tidyverse: Can't install dependency ggplot2 (>= 3.4.1)
  • ggplot2: Can't install dependency scales (>= 1.3.0)
  • scales: Needs R >= 4.1
    Type .Last.error to see the more details.

.Last.error
<callr_error/rlib_error_3_0/rlib_error/error>
Error:
! error in pak subprocess
Caused by error:
! Could not solve package dependencies:

  • tidyverse: dependency conflict
  • tidyverse: Can't install dependency ggplot2 (>= 3.4.1)
  • ggplot2: Can't install dependency scales (>= 1.3.0)
  • scales: Needs R >= 4.1

Backtrace:

  1. pak::pkg_install("tidyverse")
  2. pak:::remote(function(...) get("pkg_install_make_plan", asNamespace("pak"))(...), ...
  3. err$throw(res$error)

Subprocess backtrace:

  1. base::withCallingHandlers(cli_message = function(msg) { ...
  2. get("pkg_install_make_plan", asNamespace("pak"))(...)
  3. prop$stop_for_solution_error()
  4. private$plan$stop_for_solve_error()
  5. pkgdepends:::pkgplan_stop_for_solve_error(self, private)
  6. base::throw(new_error("Could not solve package dependencies:\n", msg, ...
  7. | base::signalCondition(cond)
  8. global (function (e) ...

Does anyone perhaps have any idea what I could do? :slight_smile:

Thank you

What about just using base R install.packages("tidyverse")?

Does this give you errors as well?

And I know this sounds really lame, but sometimes a whole fresh restart of RStudio and R helps (restarting R in the Session menu, and/or Quit Session in the Session menu and reopen RStudio) with installing packages...

This means that the scales package, and thus the tidyverse in general needs at least R version 4.1.0. You probably have an older version and you'll need to update your R version.

If you really don't want to do that, then you can use an older CRAN snapshot from Posit Package Manager, one that still supports your R version.

The OP (@Aneta.R) indicated that the new installation was R.4.5.0 which is why that error message is confusing, and which is why a fresh re-start might help.
It seems that the current session they are working in is not recognizing the correct R version?

Typing version in the console should tell you the version of R the session is using.
You can also go to the tab "Terminal" (not "Console"!) and type in R --version to get the same information. If, for some reason (after re-starting everything), this is not R.4.5.0, you can run which r in the Terminal to see where RStudio is getting its R version from on your computer (in case you installed the new version manually in a different place than the usual place it goes).

As an FYI to the OP, not sure how you updated R, but a pretty safe way to update R is to run:

install.packages("installr")
library(installr)
updateR()

The advantage is that this also updates your packages.
But for RStudio you would still have to download it from the website.

And generally I am weary of uninstalling older R versions as this might break certain "connections" (I am a data scientist, not a computer engineer or computer scientist...). If I feel I do really need to get rid of an old version, I would use uninstall.R(), also from the installr package, and I would definitely not uninstall manually.

Hello @GeraldineK , yes sadly this gives me the following errors:
ERROR: dependency 'rmarkdown' is not available for package 'reprex'

  • removing 'C:/Users/Aneta Ritz-Radlinska/Documents/R/win-library/4.0/reprex'
    Warning in install.packages :
    installation of package ‘reprex’ had non-zero exit status
    ERROR: dependencies 'dbplyr', 'dtplyr', 'googledrive', 'googlesheets4', 'modelr', 'reprex', 'rvest' are not available for package 'tidyverse'
  • removing 'C:/Users/Aneta Ritz-Radlinska/Documents/R/win-library/4.0/tidyverse'
    Warning in install.packages :
    installation of package ‘tidyverse’ had non-zero exit status

The downloaded source packages are in
‘C:\Users\Aneta Ritz-Radlinska\AppData\Local\Temp\RtmpAh9ALl\downloaded_packages’