Unable to install the car package

Hey,

I tried many, many times to install my package "car". It literally drives me crazy for days that I can't fix it by myself.

This is what I tried:

 install.packages("car", dependencies = TRUE)

Everything seems fine until now

The downloaded binary packages are in
/var/folders/47/f8jhnb1x4_s154gd7x181kpc0000gn/T//RtmpjJkprs/downloaded_packages

But when I want to load the package with "library(car)" it shows me this in red:

Fehler: package or namespace load failed for ‘car’ in dyn.load(file, DLLpath = DLLpath, ...):
 kann shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so' nicht laden:
  dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so, 6): Symbol not found: _EXTPTR_PTR
  Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so
  Expected in: /Library/Frameworks/R.framework/Resources/lib/libR.dylib
 in /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so
Zusätzlich: Warnmeldung:
Paket ‘car’ wurde unter R Version 4.0.2 erstellt

I have read here in the community that I need to install the Rcpp package and that is what I tried as well, as seen below.

> install.packages("Rcpp",dependencies = TRUE)
versuche URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/Rcpp_1.0.5.tgz'
Content type 'application/x-gzip' length 3215939 bytes (3.1 MB)
==================================================
downloaded 3.1 MB


The downloaded binary packages are in
	/var/folders/47/f8jhnb1x4_s154gd7x181kpc0000gn/T//RtmpjJkprs/downloaded_packages
> library(Rcpp)
Fehler: package or namespace load failed for ‘Rcpp’ in dyn.load(file, DLLpath = DLLpath, ...):
 kann shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so' nicht laden:
  dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so, 6): Symbol not found: _EXTPTR_PTR
  Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so
  Expected in: /Library/Frameworks/R.framework/Resources/lib/libR.dylib
 in /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so
Zusätzlich: Warnmeldung:
Paket ‘Rcpp’ wurde unter R Version 4.0.2 erstellt 

and when I then tried to use library(car) again, it showed me the same error message as before...

I have tried now so many things and I really have no idea what to do anymore, but it must have something to do with the Rcpp package!

Can anyone help me with this issue, you will be my hero!

Thanks in advance,
Fynn

(Sorry that the error messages are in German :sweat_smile: )

Das ist kein Problem

Looks like you're under macOS. When you installed Rcpp were you given a message "binary version is available, but source version is later"? If so, did you take the yes option? When this happens under macOS and doesn't succeed the first time, the best thing to do is to take the no option on the second attempt.

If you have a compiler toolchain set up compiling from source will sometimes work. Without one (XCode and its cli utility) it will always fail.

Hey,

when I installed Rcpp I wasn't asked anything, but it automatically installed it as a binary package.

I tried it with the source type, but I got another error, as seen below.
I can't take no option.

install.packages("Rcpp", type = "source")
versuche URL 'https://cran.rstudio.com/src/contrib/Rcpp_1.0.5.tar.gz'
Content type 'application/x-gzip' length 2950521 bytes (2.8 MB)
==================================================
downloaded 2.8 MB

* installing *source* package ‘Rcpp’ ...
** Paket ‘Rcpp’ erfolgreich entpackt und MD5 Summen überprüft
** using staged installation
** libs
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/  -I/usr/local/include   -fPIC  -Wall -g -O2  -c api.cpp -o api.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/  -I/usr/local/include   -fPIC  -Wall -g -O2  -c attributes.cpp -o attributes.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/  -I/usr/local/include   -fPIC  -Wall -g -O2  -c barrier.cpp -o barrier.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/  -I/usr/local/include   -fPIC  -Wall -g -O2  -c date.cpp -o date.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/  -I/usr/local/include   -fPIC  -Wall -g -O2  -c module.cpp -o module.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/  -I/usr/local/include   -fPIC  -Wall -g -O2  -c rcpp_init.cpp -o rcpp_init.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o Rcpp.so api.o attributes.o barrier.o date.o module.o rcpp_init.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-Rcpp/00new/Rcpp/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (Rcpp)

The downloaded source packages are in
	‘/private/var/folders/47/f8jhnb1x4_s154gd7x181kpc0000gn/T/RtmpjJkprs/downloaded_packages’
> library("Rcpp")
Fehler: package or namespace load failed for ‘Rcpp’ in get(Info[i, 1], envir = env):
 lazy-load database '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/R/Rcpp.rdb' is corrupt
Zusätzlich: Warnmeldung:
In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1

I will try to figure out, what you meant with your second part.

 lazy-load database '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/R/Rcpp.rdb' is corrupt

Try

remove.packages("Rcpp")
install.packages("Rcpp")

Come back if you continue to have problems, and I'll fire up my old AirBook to see if I can reproduce the issue and help troubleshoot.

That didn't work, I tried it multiple times. I feel kinda lost.

("insert the I'm in danger meme")

1 Like

I'm a sometimes windows sometimes linux user, so I can't speak from personal experience.
but I did google around and found this:

It seems to be an issue with the CRAN version of Rcpp for MacOS systems, can you try installing this way?

install.packages("Rcpp", repos="https://rcppcore.github.io/drat")

This is the GitHub issue for reference

1 Like

Finally got XCode to update to 12.3, and this setup worked.

> install.packages("Rcpp")
Installing package into ‘/Users/rc/Library/R/4.0/library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/Rcpp_1.0.5.tgz'
Content type 'application/x-gzip' length 3215939 bytes (3.1 MB)
==================================================
downloaded 3.1 MB


> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] Rcpp_1.0.5

loaded via a namespace (and not attached):
[1] compiler_4.0.3 tools_4.0.3   
> 
1 Like

Thanks buddy, you're the best! I tried around and somehow everything started to work again.

1 Like