Unable to install and load packages

I am trying to install and load packages, but I cannot figure out why it isn't working for me. Here is what I did and the warning and error messages I got:

> install.packages("tidyverse")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/

Installing package into ‘C:/Users/emily/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/tidyverse_1.3.0.zip'
Content type 'application/zip' length 440101 bytes (429 KB)
downloaded 429 KB

package ‘tidyverse’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\emily\AppData\Local\Temp\RtmpySGca2\downloaded_packages

> library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’:
 object ‘is_present’ is not exported by 'namespace:lifecycle'
In addition: Warning message:
package ‘tidyverse’ was built under R version 3.6.3

I get these messages when I try to install any package and I've never run into this error before. Any help is appreciated.

I've had problems with the R version 4 when associated with shiny context as well.
My solution was getting back to version 3.6.3 and things are working properly again

try

install.packages("lifecycle")

Thank you for the suggestion, but I get the same messages when I tried to install that package.

> install.packages("lifecycle")
Error in install.packages : Updating loaded packages
> install.packages("lifecycle")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/emily/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/lifecycle_0.2.0.zip'
Content type 'application/zip' length 101659 bytes (99 KB)
downloaded 99 KB

package ‘lifecycle’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\emily\AppData\Local\Temp\RtmpMDaZVv\downloaded_packages

but now when you do

library(tidyverse)

what message do you get ?

I get

> library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 namespace ‘dplyr’ 0.8.3 is being loaded, but >= 1.0.0 is required
In addition: Warning message:
package ‘tidyverse’ was built under R version 3.6.3

this is a different message than previously.
The problem with lifecycle has been solved.
unfortunately you have to repeat the pattern of installing defective dependencies.
Reading the message tells me you should:

install.packages("dplyr")

Thank you. I installed and loaded the dplyr package and then tried loading the tidyverse and got this:

> library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 namespace ‘tibble’ 2.1.3 is already loaded, but >= 3.0.0 is required
In addition: Warning message:
package ‘tidyverse’ was built under R version 3.6.3

Do I just keep installing the packages it says in the error messages until the problem is solved?

yes, precisely, you're on the right track.

an alternative might be to try

update.packages()

which should go through packages you already have that might be out of version and prompt you to update them.

1 Like

I got it to work, thank you so much for your help

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.