install.packages(...) fails on Windows 10 - r

I am trying to install the dplyr package from Visual Studio 2017. It has a dependency on pillar.
When I perform an install from the command line, I get:
> install.packages('pillar')
Installing package into ‘C:/Users/Jérôme Verstrynge/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is later:
binary source needs_compilation
pillar 1.2.1 1.2.2 FALSE
installing the source package ‘pillar’
trying URL 'http://cran.r-project.org/src/contrib/pillar_1.2.2.tar.gz'
Content type 'application/x-gzip' length 64185 bytes (62 KB)
downloaded 62 KB
* installing *source* package 'pillar' ...
** package 'pillar' successfully unpacked and MD5 sums checked
Warning in file(file, if (append) "a" else "w") :
cannot open file 'C:/Users/Jirtme Verstrynge/Documents/R/win-library/3.3/pillar/DESCRIPTION': No such file or directory
Error in file(file, if (append) "a" else "w") :
cannot open the connection
ERROR: installing package DESCRIPTION failed for package 'pillar'
* removing 'C:/Users/Jérôme Verstrynge/Documents/R/win-library/3.3/pillar'
There is a bogus conversion of Jérôme Verstrynge into Jirtme Verstrynge.
How can I work around this?
More information
When I perform Get-WinSystemLocale from Windows 10 PowerShell, I get:
LCID Name DisplayName
---- ---- -----------
2057 en-GB English (United Kingdom)
Sys.getlocale() returns:
[1] "LC_COLLATE=English_United Kingdom.1252;
LC_CTYPE=English_United Kingdom.1252;
LC_MONETARY=English_United Kingdom.1252;
LC_NUMERIC=C;
LC_TIME=English_United Kingdom.1252"
Workaround
I have uninstalled Microsoft R client and reinstalled it from here. The client is now on version 3.4.3.0.
The issue has disappeared for the package pillar, but it is coming back with a package called dendextend while trying to install.packages('seriation').
The error is:
> install.packages('seriation')
Installing package into ‘C:/Users/Jérôme Verstrynge/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependency ‘dendextend’
There is a binary version available but the source version is later:
binary source needs_compilation
dendextend 1.7.0 1.8.0 FALSE
trying URL 'http://cran.r-project.org/bin/windows/contrib/3.4/seriation_1.2-3.zip'
Content type 'application/zip' length 1015954 bytes (992 KB)
downloaded 992 KB
package ‘seriation’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Temp\Rtmpi2lOd8\downloaded_packages
installing the source package ‘dendextend’
trying URL 'http://cran.r-project.org/src/contrib/dendextend_1.8.0.tar.gz'
Content type 'application/x-gzip' length 1758392 bytes (1.7 MB)
downloaded 1.7 MB
* installing *source* package 'dendextend' ...
** package 'dendextend' successfully unpacked and MD5 sums checked
Warning in file(file, if (append) "a" else "w") :
cannot open file 'C:/Users/Jirtme Verstrynge/Documents/R/win-library/3.4/dendextend/DESCRIPTION': No such file or directory
Error in file(file, if (append) "a" else "w") :
cannot open the connection
ERROR: installing package DESCRIPTION failed for package 'dendextend'
* removing 'C:/Users/Jérôme Verstrynge/Documents/R/win-library/3.4/dendextend'
In R CMD INSTALL
The downloaded source packages are in
‘C:\Temp\Rtmpi2lOd8\downloaded_packages’
Warning messages:
1: running command '"C:/PROGRA~1/MIE74D~1/RCLIEN~1/R_SERVER/bin/x64/R" CMD INSTALL -l "C:\Users\Jérôme Verstrynge\Documents\R\win-library\3.4" C:\Temp\Rtmpi2lOd8/downloaded_packages/dendextend_1.8.0.tar.gz' had status 1
2: In utils::install.packages(...) :
installation of package ‘dendextend’ had non-zero exit status
>
It seems there is an issue in utils::install.packages(...)
Issue solved
Apparently, on top of re-installing Microsoft R Client, the remaining issue was related to missing binary packages not available on CRAN repositories yet.

I doubt this has anything to do with the pillar package, but perhaps with the fact that this package is installed from source (unlike the default which is to install from binary). This problem will eventually resolve itself as the binary version of pillar 1.2.2 becomes available on your CRAN mirror (it's already there on CRAN and on https://cloud.r-project.org/web/packages/pillar/index.html).
What's the value of getOption("repos") on your system?
The mis-encoding of non-ASCII characters in this particular scenario feels like a problem which is best avoided by choosing an ASCII-only and space-free directory name for your home (e.g. C:\Users\jverstry instead of your current setting). To rule out a problem with Visual Studio, you could try installing the package from RGui or from the R terminal, please double-check that the installation path for the package is the same.

Related

R cannot download websockets package from the github

The manual is written here:https://github.com/Refinitiv/websocket-api/tree/master/Applications/Examples/R
The mentioned code is written in Section 2 of Install libraries
Problems are with this part
library(devtools)
install_github("brettjbush/R-Websockets")
With R and RTools versions above 4.0 I have following error.
> install_github("brettjbush/R-Websockets")
Downloading GitHub repo brettjbush/R-Websockets#HEAD
Installing 1 packages: caTools
Installing package into ‘\\energia.sise/dfs/REDIRECT/german.suhharukov/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/caTools_1.18.0.zip'
Content type 'application/zip' length 317292 bytes (309 KB)
downloaded 309 KB
package ‘caTools’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\german.suhharukov\AppData\Local\Temp\RtmpoRYGc0\downloaded_packages
√ checking for file 'C:\Users\german.suhharukov\AppData\Local\Temp\RtmpoRYGc0\remotes1aa03e212c08\brettjbush-R-Websockets-fc7ee9c/DESCRIPTION' (1s)
- preparing 'websockets':
√ checking DESCRIPTION meta-information ...
- cleaning src
Warning in system2(command, args, stdout = NULL, stderr = NULL, ...) :
'CreateProcess' failed to run 'C:\rtools40\usr\bin\make.exe -f "C:/PROGRA~1/R/R-40~1.3/share/make/clean.mk" -f Makevars.win clean'
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
- building 'websockets_1.1.7.tar.gz'
Installing package into ‘\\sise/dfs/REDIRECT/MYNAME/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
'\\sise\dfs\REDIRECT\MYNAME\Documents'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
* installing *source* package 'websockets' ...
** using staged installation
** libs
*** arch - i386
Error in system(cmd) :
(converted from warning) 'CreateProcess' failed to run 'C:\rtools40\usr\bin\make.exe -f "Makevars.win" -f "C:/PROGRA~1/R/R-40~1.3/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-40~1.3/share/make/winshlib.mk" SHLIB="websockets.dll" OBJECTS="libsock.o"'
* removing '\\sise/dfs/REDIRECT/MYNAME/Documents/R/win-library/4.0/websockets'
Error: Failed to install 'websockets' from GitHub:
(converted from warning) installation of package ‘C:/Users/MYNAME/AppData/Local/Temp/RtmpoRYGc0/file1aa0518554ea/websockets_1.1.7.tar.gz’ had non-zero exit status
> install.packages("caTools")
Installing package into ‘\\sise/dfs/REDIRECT/MYNAME/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/caTools_1.18.0.zip'
Content type 'application/zip' length 317292 bytes (309 KB)
downloaded 309 KB
package ‘caTools’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\MYNAME\AppData\Local\Temp\XXXXXXX\downloaded_packages
>
Errors are following
> library(devtools)
Loading required package: usethis
> install_github("brettjbush/R-Websockets")
Downloading GitHub repo brettjbush/R-Websockets#master
trying URL 'https://cran.rstudio.com/bin/windows/Rtools/Rtools35.exe'
Content type 'application/x-msdownload' length 108622512 bytes (103.6 MB)
downloaded 103.6 MB
Error: Failed to install 'websockets' from GitHub:
Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
> pkgbuild::check_build_tools(debug = TRUE)
trying URL 'https://cran.rstudio.com/bin/windows/Rtools/Rtools35.exe'
Content type 'application/x-msdownload' length 108622512 bytes (103.6 MB)
downloaded 103.6 MB
Error: Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
> find_rtools()
[1] TRUE
> Sys.which("ls.exe")
ls.exe
"C:\\Rtools\\bin\\ls.exe"
How can I download this package?
In the notes on github it says "NOTE: This package is no longer maintained. For implementing websocket servers in R, try the httpuv package"
Another possible problem could be that you are running a new version of R with an old version of Rtools. So I'd try to install the newest version of Rtools or run an older version of R with a compatible version of Rtools, such that you can build and compile the package.
I ran your code on my machine running R 4.0.2 and Rtools 4.0.0 and did not face any issues installing the package. So I'd suggest installinng the newest version of R and Rtools from here: https://cran.r-project.org/bin/windows/Rtools/ and trying again.

error installing package "devtools" in R

> install.packages("devtools")
Installing package into ‘C:/Users/hyunj/OneDrive/문서/R/win-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependency ‘withr’
There is a binary version available but
the source version is later:
binary source needs_compilation
withr 2.1.1 2.1.2 FALSE
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/devtools_1.13.5.zip'
Content type 'application/zip' length 443954 bytes (433 KB)
downloaded 433 KB
package ‘devtools’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\hyunj\AppData\Local\Temp\RtmpayZaSB\downloaded_packages
installing the source package ‘withr’
trying URL 'https://cran.rstudio.com/src/contrib/withr_2.1.2.tar.gz'
Content type 'application/x-gzip' length 53578 bytes (52 KB)
downloaded 52 KB
* installing *source* package 'withr' ...
** package 'withr' successfully unpacked and MD5 sums checked
Warning in file(file, if (append) "a" else "w") :
cannot open file 'C:/Users/hyunj/OneDrive/9.<-/R/win-library/3.4/withr/DESCRIPTION': Invalid argument
Error in file(file, if (append) "a" else "w") :
cannot open the connection
ERROR: installing package DESCRIPTION failed for package 'withr'
* removing 'C:/Users/hyunj/OneDrive/문서/R/win-library/3.4/withr'
In R CMD INSTALL
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-34~1.3/bin/x64/R" CMD INSTALL -l "C:\Users\hyunj\OneDrive\문서\R\win-library\3.4" C:\Users\hyunj\AppData\Local\Temp\RtmpayZaSB/downloaded_packages/withr_2.1.2.tar.gz' had status 1
Warning in install.packages :
installation of package ‘withr’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\hyunj\AppData\Local\Temp\RtmpayZaSB\downloaded_packages’
it looks like you have localization problem. All localization problems are hard to debug. Your problem looks like to be in your path probably
C:/Users/hyunj/OneDrive/문서/R/win-library/3.4
If it would be possible to change the "문서" part for something else it might help.

Rcpp installation

I just updated R to 3.4.0 and RStudio to 1.0.143, and I reinstalled some packages. Everything was ok except for Rcpp (and packages which require Rccp), I got this :
> install.packages("Rcpp")
Warning in install.packages :
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES.rds': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4/PACKAGES.rds': HTTP status was '404 Not Found'
There is a binary version available but the source version is later:
binary source needs_compilation
Rcpp 0.12.10 0.12.11 TRUE
Do you want to install from sources the package which needs compilation?
y/n: y
installing the source package ‘Rcpp’
trying URL 'https://cran.rstudio.com/src/contrib/Rcpp_0.12.11.tar.gz'
Content type 'application/x-gzip' length 2485092 bytes (2.4 MB)
downloaded 2.4 MB
'\\CXXXX0001\Users\RXXXXn'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
'\\CXXXX0001\Users\RXXXXn\R\R-3.4.0' is not recognized as an internal or external command,
operable program or batch file.
Warning in install.packages :
running command '"//CXXXX0001/Users/RXXXn/R/R-3.4.0/bin/x64/R" CMD INSTALL -l "\\CXXXX0001\Users\RXXXXn\R\R-3.4.0\library" C:\Users\RXXX~1\AppData\Local\Temp\RtmpmOL8r0/downloaded_packages/Rcpp_0.12.11.tar.gz' had status 1
Warning in install.packages :
installation of package ‘Rcpp’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\RXXXXn\AppData\Local\Temp\RtmpmOL8r0\downloaded_packages’
I restarted my R session before doing this, so there should be no conflict of loaded packages.
What can I do ?
EDIT after user3293236 comment
I also have a problem with devtools package...
> install.packages("devtools")
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/devtools_1.13.1.zip'
Content type 'application/zip' length 440923 bytes (430 KB)
downloaded 430 KB
package ‘devtools’ successfully unpacked and MD5 sums checked
Warning in install.packages :
unable to move temporary installation ‘\\CXXXX0001\Users\RXXXXn\R\R-3.4.0\library\file16401ac3a13\devtools’ to ‘\\CXXXX0001\Users\RXXXXn\R\R-3.4.0\library\devtools’
The downloaded binary packages are in
C:\Users\RXXXXn\AppData\Local\Temp\RtmpmOL8r0\downloaded_packages
> library(devtools)
Error in library(devtools) : aucun package nommé ‘devtools’ n'est trouvé
I encountered the same issue while trying to set up someone else's computer. Brand new R installation (R version 3.4.1) but R was installed in a OneDrive folder. I also thought it was a permissions thing (as #nrussell commented) as the error was the same ... unable to move temporary installation ....
I had no issue installing devtools as normal (or any other packages) and even with Rtools installed Rcpp would not install by install.packages("Rcpp")`. Interestingly,
install.packages("Rcpp", type = 'source')
Did work after some compiling. Strange...
I had similar problem so, I installed a previous Rcpp release and worked.
install_version("Rcpp", version = "1.0.3", repos = "http://cran.us.r-project.org")
What can you do? I would start by reading the error messages.
It clearly showed you that you are offered a different source and binary version. For the former you need tools. That is abundantly documented.
And by tomorrow CRAN will also have a new binary version for you. But with a new release made hours ago, you need to wait a moment. Or make your system capable of installing from source.

error installing package rweka however rjava is up to date

I am trying to install the package RWeka. I installed the java version 8, but i am keep getting this error. Can anybody help?
> install.packages('RWeka')
There is a binary version available but the source version is later:
binary source needs_compilation
RWeka 0.4-26 0.4-33 FALSE
installing the source package ‘RWeka’
trying URL 'https://cran.rstudio.com/src/contrib/RWeka_0.4-33.tar.gz'
Content type 'application/x-gzip' length 415763 bytes (406 KB)
==================================================
downloaded 406 KB
* installing *source* package ‘RWeka’ ...
** package ‘RWeka’ successfully unpacked and MD5 sums checked
Need at least Java version 1.7/7.0.
ERROR: configuration failed for package ‘RWeka’
* removing ``‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/RWeka’
Warning in install.packages :
installation of package ‘RWeka’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/sh/6qsjq6gn0ysf4h1cv9nctzfr0000gn/T/RtmpCVEaSY/downloaded_packages’``
From experience, I believe there is a difference between Java and Java Offline.
Try installing the x86/x64 offline version from http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html (A handy link to keep hold of)
If you have the newest Java, just open a terminal and run
sudo R CMD javareconf
Then in a R-session,
install.packages("rJava",type='source')
install.packages("RWeka")
Ref: https://justrocketscience.com/post/install-rweka-mac

Why do I get this error installing rmarkdown

I try to use rmarkdown and I've got many troubles so far. The first one is when the Rstudio as if it should install new versions of packages. It can not go over it. I tried to install one by one all the required packages but than I got this error
trying URL 'https://cran.rstudio.com/bin/windows/contrib/2.15/knitr_1.5.zip'
Content type 'application/zip' length 910172 bytes (888 Kb)
opened URL
downloaded 888 Kb
package ‘evaluate’ successfully unpacked and MD5 sums checked
package ‘digest’ successfully unpacked and MD5 sums checked
package ‘formatR’ successfully unpacked and MD5 sums checked
package ‘highr’ successfully unpacked and MD5 sums checked
package ‘markdown’ successfully unpacked and MD5 sums checked
package ‘stringr’ successfully unpacked and MD5 sums checked
package ‘knitr’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\mali\AppData\Local\Temp\Rtmpcz1Ywk\downloaded_packages
Error: invalid version specification ‘NA’
In addition: Warning message:
In utils:::packageDescription(packageName, fields = "Version") :
no package 'knitr' was found
I installed packages one by one and I can load them but it does not work as a whole i.r. file -> new -> rmarkdown
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: i386-w64-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=Swedish_Sweden.1252 LC_CTYPE=Swedish_Sweden.1252 LC_MONETARY=Swedish_Sweden.1252 LC_NUMERIC=C
[5] LC_TIME=Swedish_Sweden.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rmarkdown_0.9.6 knitr_1.12.3
loaded via a namespace (and not attached):
[1] digest_0.6.9 htmltools_0.3.5 Rcpp_0.12.4 tools_3.1.2
I spotted recently that I got this kind of message when starting Rstudio
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
Error: invalid version specification ‘NA’
In addition: Warning message:
In utils:::packageDescription(packageName, fields = "Version") :
no package 'knitr' was found
>
I did as #DAV recommended. Tried to install other version. No success
> url <- "https://cran.r-project.org/src/contrib/Archive/knitr/knitr_1.0.tar.gz"
> install.packages(url, repos=NULL, type="source")
Installing package into ‘\\xxx/users/Eke/mali/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.r-project.org/src/contrib/Archive/knitr/knitr_1.0.tar.gz'
Content type 'application/x-gzip' length 451348 bytes (440 Kb)
opened URL
downloaded 440 Kb
* installing *source* package 'knitr' ...
** package 'knitr' successfully unpacked and MD5 sums checked
** R
** demo
** inst
** preparing package for lazy loading
Warning in file(con, "r") :
file("") only supports open = "w+" and open = "w+b": using the former
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) :
there is no package called 'knitr'
Error: loading failed
Execution halted
ERROR: loading failed
* removing '\\xxxxxx/users/Eke/mali/Documents/R/win-library/3.1/knitr'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-31~1.2/bin/i386/R" CMD INSTALL -l "\\xxxxx\users\Eke\mali\Documents\R\win-library\3.1" "C:/Users/mali/AppData/Local/Temp/RtmpoN1qrM/downloaded_packages/knitr_1.0.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘C:/Users/mali/AppData/Local/Temp/RtmpoN1qrM/downloaded_packages/knitr_1.0.tar.gz’ had non-zero exit status
It drives me crazy. I uninstalled "knitr" and tried to install again. ERROR
> install.packages("knitr", dependencies = F)
Installing package into ‘\\xxxx.se/users/Eke/mali/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.1/knitr_1.12.3.zip'
Content type 'application/zip' length 812186 bytes (793 Kb)
opened URL
downloaded 793 Kb
package ‘knitr’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\mali\AppData\Local\Temp\RtmpaChLQ5\downloaded_packages
Error: invalid version specification ‘NA’
In addition: Warning message:
In utils:::packageDescription(packageName, fields = "Version") :
no package 'knitr' was found
And it happened when I wanted to install shiny
> install.packages("shiny", dependencies = F)
Installing package into ‘\\xxxxx.xxx/users/Eke/mali/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.1/shiny_0.13.2.zip'
Content type 'application/zip' length 2257481 bytes (2.2 Mb)
opened URL
downloaded 2.2 Mb
package ‘shiny’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\mali\AppData\Local\Temp\RtmpC0nOFC\downloaded_packages
Error: invalid version specification ‘NA’
In addition: Warning message:
In utils:::packageDescription(packageName, fields = "Version") :
no package 'knitr' was found
You can tell RStudio the location of your library through the .libPaths()
command and then manually selecting knitr and the other packages necessary to use the "rmarkdown" documents in RStudio through the Packages window in your screen.
getwd()
# "C:/Users/s146753/Dropbox/Chapter 2"
.libPaths()
# "\\\\home2.bio.ed.ac.uk/s146753/R/win-library/3.3" "C:/Program Files/R/R-3.3.2/library"
.libPaths("C:/Program Files/R/R-3.3.2/library")
.libPaths()
# "C:/Program Files/R/R-3.3.2/library"

Resources