12

I am trying to install packages (devtools, plyr and several others) and keep getting stuck with the same problem, which seems to appear for some packages more often than others

 There are binary versions available but the
  source versions are later:
          binary source needs_compilation
processx  2.0.0.1  3.2.1              TRUE
desc        1.1.1  1.2.0             FALSE
callr       1.0.0  3.1.1             FALSE
git2r      0.21.0 0.24.0              TRUE
rcmdcheck   1.2.1  1.3.2             FALSE
usethis     1.1.0  1.4.0             FALSE
devtools   1.13.4  2.0.1             FALSE

Do you want to install from sources the packages which need compilation?

OK, well, I honestly have no idea what that means, but chances are 50/50

Whether I choose y or n I end up with:

Packages which are only available in source
  form, and may need compilation of
  C/C++/Fortran: ‘ps’ ‘fs’ ‘pkgload’
Do you want to attempt to install these from sources?
y/n: 

and whether I choose y or n here I end up with

Warning in install.packages :
  installation of package ‘devtools’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/zz/mxrvmdvd2j399kfylbspjp4r0000gn/T/Rtmp1OdcyF/downloaded_packages’

I am operating on Mac Mojave 10.4.2 with RStudio 1.1.463

My expected result was for the package to be installed and I could use something like library(package) to get started with my work.

I am somewhat experienced in working with R and have never encountered this problem until recently? Do I need to update sth? Change a setting?

UPDATE: ggplot2 and biomod2 are showing the same issue UPDATE: seems to be no problem with R (not RStudio) and the R package manager.... why is this the case?

Gmichael
  • 526
  • 1
  • 5
  • 16
  • 3
    I encounter this kind of issues because I am stuck with an older R version, dependencies are a mess in R unfortunately as they have to be declared explicitly, and there is binary/source issue on top of it. The way I sort it out is, if I can't install a given package because of dependencies that are only available in source and that I can't get to install successfully, I go to the CRAN page of the package (devtools for you), go archive and download the latest old packages, and install them from file from recent to older until it works. – moodymudskipper Jan 24 '19 at 12:46
  • 1
    It's frustrating not to be able to do it automatically (I'm sure it could be automated) but that works for me. I actually happen to use an older version of devtools for this reason. – moodymudskipper Jan 24 '19 at 12:46
  • So, you are saying that if I update my R version it should work? – Gmichael Jan 24 '19 at 12:48
  • 1
    You should update R to the newest version and install this tool chain: https://github.com/rmacoslib/r-macos-rtools – Roland Jan 24 '19 at 12:50
  • Because I have the most current version, so why does this happen? – Gmichael Jan 24 '19 at 12:50
  • You could also just wait. The binaries will probably be available sooner or later. Alternatively, try a different CRAN mirror in case yours is out of sync. – Roland Jan 24 '19 at 12:52
  • I'm not saying this, but the current situation (all packages to the latest version) is always the most tested one, in other case you're placing yourself at different points on different package timelines, and R doesn't handle these things well and you can enter dependency hell. – moodymudskipper Jan 24 '19 at 12:53
  • 1
    devtools is a prominent package, so normally on an up to date installation, it "should" work fine or be corrected really quick, I'm using windows though, so our issues are slightly different. – moodymudskipper Jan 24 '19 at 12:55
  • @Roland: How can I tell if my CRAN-mirror is out of sync? – Gmichael Jan 24 '19 at 13:12
  • By testing with a different mirror. (In RStudio, see Tools --> Global Options --> Packages) – Roland Jan 24 '19 at 13:20
  • Thanks, but that doesn't change a thing. – Gmichael Jan 27 '19 at 07:58

2 Answers2

3

After reading this question/solution plus others, and experimenting with a package update, I wrote the following paragraph in my own instruction (to myself) for updating R packages. I'm posting it here, because I think it may be helpful to others. I'm pretty sure it is correct, except that some updates may fail for reasons that have nothing to do with their compilation status.

On the pop-up, "Do you want to install from source the packages which need compilation?", [No] will ensure that all packages get updated, but not necessarily to their latest versions. [Yes] should update everything to its latest version, but only if you installed the latest Rtools. If Rtools is not up to date, then among packages that have not yet been compiled to binaries, [Yes] will successfully update some (or none) and will fail on some (or none). If any fail, then update.packages() can be run again, selecting [No] to get the latest versions available without updating Rtools.

Arnold Cross
  • 199
  • 1
  • 12
1

For packages where it says needs compilation : TRUE you would need RTools if you hit "n" on the dialog box.

RTools usually are installed in the C: Drive on Windows.

This question is similar to yours.

How do I install an R package from source?