Can't able read excel in my laptop But the same code is working in others PC

Hi guys,

I am trying to read excel in my laptop and can't able to read it.

Below are the libraries I used in the code

#--- Loading required libraries

library(readxl)
Warning message:
package ‘readxl’ was built under R version 4.0.5
library(lubridate)

Attaching package: ‘lubridate’

The following objects are masked from ‘package:base’:

date, intersect, setdiff, union

Warning message:
package ‘lubridate’ was built under R version 4.0.5

library(dplyr)
Error: package or namespace load failed for ‘dplyr’:
.onLoad failed in loadNamespace() for 'rlang', details:
call: NULL
error: The rlang package is not properly installed.
The DLL version does not correspond to the package version.
Please update rlang to the latest version.
Updating packages on Windows requires precautions:
https://github.com/jennybc/what-they-forgot/issues/62
In addition: Warning message:
package ‘dplyr’ was built under R version 4.0.5
library(xlsx)
Warning message:
package ‘xlsx’ was built under R version 4.0.5
library(readxlsb)
Warning message:
package ‘readxlsb’ was built under R version 4.0.5
library(tidyr)
Error: package or namespace load failed for ‘tidyr’:
.onLoad failed in loadNamespace() for 'rlang', details:
call: NULL
error: The rlang package is not properly installed.
The DLL version does not correspond to the package version.
Please update rlang to the latest version.
Updating packages on Windows requires precautions:
https://github.com/jennybc/what-they-forgot/issues/62
In addition: Warning message:
package ‘tidyr’ was built under R version 4.0.5
library(crayon)
library(openxlsx)

Attaching package: ‘openxlsx’

The following objects are masked from ‘package:xlsx’:

createWorkbook, loadWorkbook, read.xlsx, saveWorkbook, write.xlsx

And Below is the error that i am encountering

Error Message:
Error in sheets_fun(path) : object '_readxl_xlsx_sheets' not found

What is your version of R?

It looks like your R version and those package versions are incompatible.

The current version of R is R 4.3.3 I believe.

It is 4.0.3 and my friend's PC also has the same version. it's working in his R studio but not in mine

Hi, try to update the library rlang.

install.packages('rlang')

Tried installing rlang. Still same error

You have several packages installed that were built under a newer version of R than you have. This is usually not a good thing.

The best solution would be to move up to the most recent version of R. If that is not possible, I think you can revert to older versions of the packages but I do not know how.

Ok, Thanks for the info. I will try updating my R version and update it here

When I try to install rlang, I am getting this error

library(rlang)
Error: package or namespace load failed for ‘rlang’:
.onLoad failed in loadNamespace() for 'rlang', details:
call: NULL
error: The rlang package is not properly installed.
The DLL version does not correspond to the package version.
Please update rlang to the latest version.
Updating packages on Windows requires precautions:
https://github.com/jennybc/what-they-forgot/issues/62
In addition: Warning message:
package ‘rlang’ was built under R version 4.0.5

I don't know much about windows.

Have you updated R to R 4.3.3 ?

If so, you may be loading an old workspace.

First, set RStudio to not save or load a workspace.

Then, completely shutdown R & RStudio. I'd reboot the computer and then try the installation.

You also might want to see what packages are loading when you fire up RStudio before you try an installation.

 # See what packages are loaded.
installed.packages()[names(sessionInfo()$otherPkgs), "Version"]

I will try this and let you know. Thanks for the info

FWIW, in my experience a good way to deal with package installation problems on Windows is to

  1. use GitHub - r-lib/rig: The R Installation Manager, which creates a separate package library for each R version, so you don't end up using packages built for another R version. (You'ld also need to remove your customization of package libraries if you did that.). Then
  2. use GitHub - r-lib/pak: A fresh approach to package installation to install packages. pak unloads packages that are loaded , and handles that case when they are loaded in another R session.

If you are sure that your libraries are set up correctly, then you don't need step 1, but I would still try step 2.

This topic was automatically closed 21 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.