Can't load R packages after installation

1.2k Views Asked by At

So I have installed R 3.6.3 and I am getting errors when I am trying to load packages, after installing them. I am getting the following errors -

> library(cartogram)
Error: package or namespace load failed for ‘cartogram’ in get(Info[i, 1], envir = env):
lazy-load database 'C:/Users/soumy/Documents/R/win-library/3.6/Rcpp/R/Rcpp.rdb' is corrupt
In addition: Warning message:
In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1
> library(tmap)
Error: package or namespace load failed for ‘tmap’ in get(Info[i, 1], envir = env):
lazy-load database 'C:/Users/soumy/Documents/R/win-library/3.6/digest/R/digest.rdb' is corrupt
In addition: Warning message:
In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1
> library(devtools)
Loading required package: usethis
Error: package or namespace load failed for ‘usethis’ in get(Info[i, 1], envir = env):
lazy-load database 'C:/Users/soumy/Documents/R/win-library/3.6/rlang/R/rlang.rdb' is corrupt
Error: package ‘usethis’ could not be loaded
In addition: Warning message:
In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1
> library(pacman)
> pacman :: p_load(ggplot2)
Installing package into ‘C:/Users/soumy/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Warning: unable to access index for repository 
http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.6:
 cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.6/PACKAGES'
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/ggplot2_3.3.2.zip'
Content type 'application/zip' length 4068914 bytes (3.9 MB)
downloaded 3.9 MB

package ‘ggplot2’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\soumy\AppData\Local\Temp\RtmpcTrH1e\downloaded_packages

ggplot2 installed
Warning messages:
1: In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1
2: In pacman::p_load(ggplot2) : Failed to install/load:
ggplot2

I have tried adding R, Rtools and Rstudio to the system variable Path, tried restarting R, tried reinstalling R multiple times but no luck.

I tried to install R in Anaconda Jupyter notebook too, although it was installed the R kernel didn't load and showed these errors -

Error in get(Info[i, 1], envir = env) :
  lazy-load database 'C:/Users/soumy/Documents/R/win-library/3.6/digest/R/digest.rdb' is corrupt
Calls: :: ... namespaceImport -> loadNamespace -> registerS3methods -> get
In addition: Warning message:
In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1
Execution halted
[I 03:27:26.891 LabApp] Kernel started: e5475cc5-3dcc-4ab4-a0fb-a4c106b53d4f
[I 03:27:27.380 LabApp] KernelRestarter: restarting kernel (1/5), new random ports
Error in get(Info[i, 1], envir = env) :
 lazy-load database 'C:/Users/soumy/Documents/R/win-library/3.6/digest/R/digest.rdb' is corrupt
Calls: :: ... namespaceImport -> loadNamespace -> registerS3methods -> get
In addition: Warning message:
In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1
Execution halted

The similar nature of the error suggests that maybe there is something wrong with the R console?

Please help.

1

There are 1 best solutions below

0
On

I had a silmilar problem but with Clusterprofiler and other packages:

"Error: Failed to load package or namespace for 'clusterProfiler' in get(Info[i, 1], envir = env): lazy-load database 'C:/Users/mailen/Documents/R/ win-library/4.1/scales /R/scales.rdb' is corrupt In addition: Warning message: In get(Info[i, 1], envir = env): internal error -3 in R_decompress1"

The solution was to uninstall R and then install the latest version, after uninstall R studio and reinstall it. I found that for some strange reason Rstudio and R weren't using the same version