my google research didn't bring up any usefull results and at this point I don't know what I could try anymore. I am trying to install devtools, in the following setup:
Ubuntu 20.04 (Virtualboax)
R.version.string = "R version 3.6.3 (2020-02-29)"
New installation of RStudio (Version 1.2.5042)
I tried to google the specific error ("Error: .onLoad failed in loadNamespace() for 'pkgload', details:"). I found this one link on which the legendary hadley wickham suggested updating the rlang package. Which I did. However it didn't fix the issue.
Has anybody any idea?
I also installed the necessary system dependenvies. However I just got those after I already started the install.packages("devtools")
Hi andresrcs, thank you very much for answer/ help.
I restarted the system / RStudio as well as the R session.
Installing in "pkgload", which results sadly in a similar looking error:
> install.packages("pkgload")
Installing package into ‘/home/bjoern/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/pkgload_1.0.2.tar.gz'
Content type 'application/x-gzip' length 55605 bytes (54 KB)
==================================================
downloaded 54 KB
* installing *source* package ‘pkgload’ ...
** package ‘pkgload’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c unlock.c -o unlock.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o pkgload.so unlock.o -L/usr/lib/R/lib -lR
installing to /home/bjoern/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-pkgload/00new/pkgload/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘pkgload’:
.onLoad failed in loadNamespace() for 'pkgload', details:
call: readRDS(nsInfoFilePath)
error: error reading from connection
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/bjoern/R/x86_64-pc-linux-gnu-library/3.6/pkgload’
* restoring previous ‘/home/bjoern/R/x86_64-pc-linux-gnu-library/3.6/pkgload’
Warning in install.packages :
installation of package ‘pkgload’ had non-zero exit status
Thank you again. I solved it in the meantime (with help from SO, tbh).
I had to install testthat before trying to install pkgload.
So the final solution (in R code) looked like this:
This seems to be a known problem (at least I found a similar report on pkgload's github). Despite in my case, the error was not as clear as on the github page. However installing testthat beforehand solved the issue for me.