install renv 0.13.0 --> Error: package or namespace load failed for ‘renv’:

I have a linux laptop with R 4.0.4

I was trying to update packages from CRAN and the update of renv from 0.12.5 to 0.13.0 failed with the message "Error: package or namespace load failed ". It failed a second attempt - so, not transient weirdness in the download.

I tried uninstalling and re-installing renv. That was probably a bad idea because the uninstall worked and the re-install failed.

I decided to cut my losses and install the development version from GitHub.

I am hoping that the problem will have gone away the next time the version of renv on CRAN is updated.

> remove.packages("renv", lib="~/R/x86_64-pc-linux-gnu-library/4.0")


> install.packages("renv")
Installing package into ‘/home/ross/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/renv_0.13.0.tar.gz'
Content type 'application/x-gzip' length 413734 bytes (404 KB)
==================================================
downloaded 404 KB

* installing *source* package ‘renv’ ...
** package ‘renv’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘renv’:
 .onLoad failed in loadNamespace() for 'renv', details:
  call: if (last %in% endings) return(TRUE)
  error: argument is of length zero
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/ross/R/x86_64-pc-linux-gnu-library/4.0/renv’
Warning in install.packages :
  installation of package ‘renv’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/Rtmp4GzUP5/downloaded_packages’


> remotes::install_github("rstudio/renv")
Downloading GitHub repo rstudio/renv@HEAD
✓  checking for file ‘/tmp/Rtmp4GzUP5/remotes22c361c4c3be/rstudio-renv-1fc1e29/DESCRIPTION’ ...
─  preparing ‘renv’:
✓  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
   Removed empty directory ‘renv/tests/testthat/resources/dummy.Rmd’
─  building ‘renv_0.13.0-2.tar.gz’
   
Installing package into ‘/home/ross/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package ‘renv’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (renv)
> 
1 Like

Thanks for the bug report! It looks like this issue can occur if you have an empty user profile; that is, if ~/.Rprofile exists but is empty. The simplest workaround is either:

  1. Remove that file altogether, or
  2. Add some (arbitrary) content.

I'll get this fixed up for the next release of renv.

2 Likes

Thanks @kevinushey !

I confirm that I did indeed have an empty ~/.Rprofile (I've no idea why) and that deleting that file allowed me to install renv from my usual CRAN mirror.

Bonza!

Glad to hear that fixed it up! Sorry for the trouble, but glad we were able to quickly find and resolve the issue.

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