Which version of R?

22 views
Skip to first unread message

David Heckel

unread,
Aug 31, 2022, 9:56:18 AM8/31/22
to STITCH imputation

Which version of R is required?  With R 4.0.0 I have the following problem:

 

sudo ./scripts/install-dependencies.sh

Error: package or namespace load failed for ‘optparse’:

 package ‘optparse’ was installed before R 4.0.0: please re-install it

Installing package into ‘/usr/local/lib/R/site-library’

(as ‘lib’ is unspecified)

trying URL 'http://cran.rstudio.com/src/contrib/optparse_1.7.3.tar.gz'

Content type 'application/x-gzip' length 41707 bytes (40 KB)

==================================================

downloaded 40 KB

 

* installing *source* package ‘optparse’ ...

** package ‘optparse’ successfully unpacked and MD5 sums checked

** using staged installation

** R

** exec

** inst

** byte-compile and prepare package for lazy loading

Error: package ‘getopt’ was installed before R 4.0.0: please re-install it

Execution halted

ERROR: lazy loading failed for package ‘optparse’

* removing ‘/usr/local/lib/R/site-library/optparse’

* restoring previous ‘/usr/local/lib/R/site-library/optparse’

 

The downloaded source packages are in

    ‘/tmp/RtmpBe6TQI/downloaded_packages’

Loading required package: optparse

Error: package or namespace load failed for ‘optparse’:

 package ‘optparse’ was installed before R 4.0.0: please re-install it

Error: Failed to install package:optparse

In addition: Warning message:

In install.packages(package, repos = "http://cran.rstudio.com/") :

  installation of package ‘optparse’ had non-zero exit status

Execution halted

Robert Davies

unread,
Sep 1, 2022, 4:37:48 AM9/1/22
to STITCH imputation
Hi,

I think this is an R problem (rather than a STITCH problem). I have two recommendations. 

First, if you are not a big fan / user of R, check out the conda installation, with instructions on the README. It should install all the R packages and dependencies you need to run STITCH in its own environment without you having to worry about stuff like this.

Alternatively, from error messages like these
"Error: package ‘getopt’ was installed before R 4.0.0: please re-install it"
I'm going to guess you recently updated your version of R, but are using library paths in R that point to libraries installed with an earlier version of R. In that case, I would either change the values in .libPaths() to no longer reference the old directories, or alternatively, delete all non-system R libraries in that/those folders and re-install all the packages like above fresh from CRAN/etc.

Best,
Robbie

David G. Heckel

unread,
Sep 1, 2022, 4:50:26 AM9/1/22
to Robert Davies, STITCH imputation
Dear Robbie,

Thanks for your quick reply.  But it would be much simpler if you could just tell me what version of R you were using when you released STITCH.  There is another package that is required by your r-dependencies script that simply doesn’t exist anymore in R 4.0.  I can downgrade my installation of R to the earlier version and then I won’t have to worry about these compatibility problems.   

Cheers,
—David


--
You received this message because you are subscribed to a topic in the Google Groups "STITCH imputation" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stitch-imputation/QdyyHfehpMY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stitch-imputat...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/stitch-imputation/bd8f68f1-4241-4d6b-99c2-497a427822b0n%40googlegroups.com.

Robbie Davies

unread,
Sep 1, 2022, 4:54:49 AM9/1/22
to David G. Heckel, STITCH imputation
Hi David,

I used version 3 of R when I released STITCH. However that was ~6 years ago. The version of R shouldn't matter, it should be possible to install on version 3 or version 4. Your error message doesn't indicate that an R package isn't available for version 4 - it indicates you have a pre version 4 version installed which you need to reinstall. 

Best,
Robbie

David G. Heckel

unread,
Sep 1, 2022, 5:12:11 AM9/1/22
to Robbie Davies, STITCH imputation
Dear Robbie,

thanks—I will work with R 3.something.  R 3.4.0 would correspond to about April 2017, but if you had installed R on your machine in April 2016 I should use R 3.3.0.

In the Readme for STITCH, please add the version information for R.  That would be most helpful to people who have just discovered STITCH, like me.

You are correct, my error message does not indicate that an error package isn’t available for Version 4.

from install-r-dependencies.R

required_packages <- c("proftools", "Rcpp", "RcppArmadillo", "optparse", "devtools", "testthat", "roxygen2", "data.table")    

My initial problem was with “optparse”  After sending my message, I found another way to install “optparse", I encountered a problem with “devtools” that I could not solve.  I could not find a version of “devtools" compatible with R 4.2.1.  See below:

Cheers,
—David


R version 4.2.1 (2022-06-23) -- "Funny-Looking Kid"

Copyright (C) 2022 The R Foundation for Statistical Computing

Platform: x86_64-pc-linux-gnu (64-bit)

> install.packages("devtools", repos = "http://R-Forge.R-project.org")

Installing package into ‘/usr/local/lib/R/site-library’

(as ‘lib’ is unspecified)

Warning message:

package ‘devtools’ is not available for this version of R

 

A version of this package for your version of R might be available elsewhere,

see the ideas at

https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

> av <- available.packages(filters=list())

> av[av[, "Package"] == devtools, ]

Error: object 'devtools' not found

> q()

Robbie Davies

unread,
Sep 1, 2022, 5:17:01 AM9/1/22
to David G. Heckel, STITCH imputation
I'll add that the original version was version 3, but it should still work with R>=4

R 4.2.1 is very new, maybe it hasn't gotten over to that repo yet? 

I'm using 4.2.1 and indeed
install.packages("devtools", repos = "http://R-Forge.R-project.org")
gives me an error message like what you describe, but 
install.packages("devtools", repos="http://cran.us.r-project.org")
works without issue, as does
install.packages("devtools") 
with a UK chosen site 

Best,
Robbie




Reply all
Reply to author
Forward
0 new messages