1

I want to use package semPlot and I get the error message as follows.

library(semPlot) Error: package or namespace load failed for ‘semPlot’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): namespace ‘rlang’ 1.0.6 is already loaded, but >= 1.1.0 is required In addition: Warning message: package ‘semPlot’ was built under R version 4.2.3

However, the latest version of rlang is 1.0.6 https://cran.r-project.org/src/contrib/Archive/rlang/

I have tried these codes: install.packages("rlang") library(semPlot) install.packages("semPlot", dependencies = TRUE)

Yujie Liu
  • 11
  • 1
  • 3
  • I can see that the latest version of rlang is 1.1.0 https://cran.r-project.org/web/packages/rlang/index.html – NicChr Apr 15 '23 at 08:53

2 Answers2

1

As @NicChr said, the current CRAN version of rlang is 1.1.0. The page you quoted https://cran.r-project.org/src/contrib/Archive/rlang/ is for old versions, not current ones.

Running update.packages(ask = FALSE) will probably get you the newest CRAN versions of all packages. However, it might fail if you already have old versions loaded, so you should do this as the first thing in a new session, before running any other code.

It may also cause problems if you don't have write permissions on your system library, because then it will create a user library for you, and you can end up with different versions of packages in the two libraries. If that happens, my advice would be to exit R, run it with admin privileges, and delete the old versions.

In fact, it might make sense to delete every package except "base" packages from the system library. Then exit R, run again with regular privileges, and re-install the ones you want, so they go into your user library. This way you won't run into this problem again.

user2554330
  • 37,248
  • 4
  • 43
  • 90
0

To elaborate on the comment, you can install the development version as set out on the github repo. The instructions there suggest using pak:pgk_install(). However if you do not have this package you can also use devtools::install_github().

packageVersion("rlang") # ‘1.0.6’
devtools::install_github("r-lib/rlang")
packageVersion("rlang") # ‘1.1.0.9000’

The pak library seems to be primarily to install and manage packages, while devtools contains useful functions for package developers, so if you have neither installed already you may prefer pak if you're not developing packages.

SamR
  • 8,826
  • 3
  • 11
  • 33