Stringi Package Installation Failure

On my PC, since R-3.4.4 and now 3.5.1Tools/Check Package Updates/ and some packages have not updated with recent versions of the Desktop IDE now currently 1.1.453 with WIn10 1803, but it was OK with a few Win10 and IDE.

> install.packages("stringi")
Installing package into ‘C:/Users/Admin/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
        binary source needs_compilation
stringi  1.1.7  1.2.3              TRUE

  Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/stringi_1.1.7.zip'
Content type 'application/zip' length 14368013 bytes (13.7 MB)
downloaded 13.7 MB

package ‘stringi’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\Admin\AppData\Local\Temp\RtmpCy91kj\downloaded_packages
>

but then on again using Tools/Check for Packages

image

it has not been updated.

Sometimes the effect is differently unproductive:

> install.packages("smacof")
Installing package into ‘C:/Users/Admin/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependencies ‘stringr’, ‘rlang’, ‘Formula’, ‘latticeExtra’, ‘acepack’, ‘gridExtra’, ‘data.table’, ‘htmlTable’, ‘viridis’, ‘htmltools’, ‘base64enc’, ‘gdata’, ‘mice’, ‘RColorBrewer’, ‘slam’, ‘Rcpp’, ‘car’, ‘heplots’, ‘polynom’, ‘Hmisc’, ‘colorspace’, ‘nnls’, ‘weights’, ‘ellipse’, ‘wordcloud’, ‘candisc’

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/stringr_1.3.1.zip'
Content type 'application/zip' length 194799 bytes (190 KB)
downloaded 190 KB

. . . continuing the like to . . .

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/smacof_1.10-8.zip'
Content type 'application/zip' length 587812 bytes (574 KB)
downloaded 574 KB

Error in install.packages : cannot open file 'C:/Users/Admin/Documents/R/win-library/3.5/file4738517273d/stringr/help/figures/logo.png': Permission denied
>

Can this be remediated?

For the first problem, the package did not update to version 1.2.3 because that version is only available as source and R for Windows will typically default to installing the latest available binary (version 1.1.7). That's what the line "Binaries will be installed" in the output means. If this is happening to you more often recently, it's most likely because pre-compiled binaries aren't available for these packages with your combination of R version and OS version. You can force installation from source by calling:

install.packages("stringi", type = "source")

but for packages that include non-R code (such as stringi, which has major parts written in C++), you will need to have the Windows RTools installed correctly first. These are additional software tools installed separately from R. The key documentation and resources are:

Some people like using the package installr, which tries to make some of this stuff easier.


For the second problem, there are a couple of different things which I'm aware of that can cause this, all relating to security and anti-malware restrictions.

  • R doesn't always interact well with Windows User Account Control (see R for Windows FAQ 2.24). This can usually be solved by running R (or RStudio) as Administrator for sessions when you want to install or update packages.

  • Increasingly, it seems that anti-virus / anti-malware software will try to keep unauthorized programs from making changes to user directories, as a defense against ransomware. According to what I've read, this can include the new Windows Controlled Folder Access, which became available starting with Windows 10 version 1709. In these cases, people seem to solve the problem by turning off restrictions for R and RStudio within the anti-malware software settings.


A general note: both of these problems are more likely to do with R than with the RStudio IDE (what's the difference? see Differentiating R from RStudio). You can find out by trying the same actions when running R directly (e.g., by opening Rgui.exe). If you see the same problem, then it's not an RStudio IDE issue and it would be better to move the question to the #general category to cut down on noise in the #rstudio-ide category.