R does not find "update.packages" - r

I am running R in version 3.4.1 under Windows 7 64-bit. When I give update.packages(ask=FALSE) the routine starts, identifies some packages to be updated, downloads packages, and then returns:
Error in update.packages(ask = FALSE) :
could not find function "update.packages"
Execution halted
I cannot find a reason for this problem. I just installed the newest version of R.
Complete output: I add the complete output. Maybe the problem is hidden in here, see e.g. the Warning messages. I shortened some paths (...). The problem seems to be with package knitr?
There are binary versions available but the source versions are later:
binary source needs_compilation
knitr 1.16 1.17 FALSE
rlang 0.1.1 0.1.2 TRUE
Binaries will be installed
trying URL 'https://cran.wu.ac.at/bin/windows/contrib/3.4/rlang_0.1.1.zip'
Content type 'application/zip' length 466606 bytes (455 KB)
downloaded 455 KB
package ‘rlang’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\...
installing the source package ‘knitr’
trying URL 'https://cran.wu.ac.at/src/contrib/knitr_1.17.tar.gz'
Content type 'application/x-gzip' length 769923 bytes (751 KB)
downloaded 751 KB
Error in update.packages(ask = FALSE) :
could not find function "update.packages"
Execution halted
The downloaded source packages are in
‘C:\Users\...’
Warning messages:
1: running command '"C:/PROGRA~1/R/R-34~1.1/bin/x64/R" CMD INSTALL -l "N:\RLibrary" C:\Users\...' had status 1
2: In install.packages(update[instlib == l, "Package"], l, repos = repos, :
installation of package ‘knitr’ had non-zero exit status

Related

Issues installing dada2 in R v.4.2.1

As the title states, I'm trying to install the dada2 library on R v. 4.2.1, for some upcoming eDNA analyses. However, when trying to run the following installation code:
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("dada2", version = "3.15")
I get the following output:
'getOption("repos")' replaces Bioconductor standard repositories, see
'?repositories' for details
replacement repositories:
CRAN: https://cran.rstudio.com/
Bioconductor version 3.15 (BiocManager 1.30.18), R 4.2.1 (2022-06-23
ucrt)
Old packages: 'brew', 'jsonlite', 'ragg', 'RCurl'
Update all/some/none? [a/s/n]:
When I update the old packages, I get the following output:
There are binary versions available but the source versions are
later:
binary source needs_compilation
jsonlite 1.8.1 1.8.2 TRUE
RCurl 1.98-1.8 1.98-1.9 TRUE
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/brew_1.0-8.zip'
Content type 'application/zip' length 78734 bytes (76 KB)
downloaded 76 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/ragg_1.2.3.zip'
Content type 'application/zip' length 1300158 bytes (1.2 MB)
downloaded 1.2 MB
package ‘brew’ successfully unpacked and MD5 sums checked
package ‘ragg’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\robinc4\AppData\Local\Temp\RtmpwR2WRF\downloaded_packages
installing the source packages ‘jsonlite’, ‘RCurl’
trying URL 'https://cran.rstudio.com/src/contrib/jsonlite_1.8.2.tar.gz'
Content type 'application/x-gzip' length 1053090 bytes (1.0 MB)
downloaded 1.0 MB
trying URL 'https://cran.rstudio.com/src/contrib/RCurl_1.98-1.9.tar.gz'
Content type 'application/x-gzip' length 731611 bytes (714 KB)
downloaded 714 KB
The downloaded source packages are in
‘C:\Users\robinc4\AppData\Local\Temp\RtmpwR2WRF\downloaded_packages’
Warning messages:
1: package(s) not installed when version(s) same as current; use `force =
TRUE` to re-install: 'dada2'
2: In install.packages(update[instlib == l, "Package"], l, repos = repos, :
installation of package ‘jsonlite’ had non-zero exit status
3: In install.packages(update[instlib == l, "Package"], l, repos = repos, :
installation of package ‘RCurl’ had non-zero exit status
Afterwards, I tried this code:
install.packages("devtools")
library("devtools")
devtools::install_github("benjjneb/dada2", ref="v1.16") # change the ref argument to get other versions
And get following output:
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/devtools_2.4.4.zip'
Content type 'application/zip' length 429292 bytes (419 KB)
downloaded 419 KB
package ‘devtools’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\robinc4\AppData\Local\Temp\RtmpwR2WRF\downloaded_packages
> library("devtools")
Loading required package: usethis
> devtools::install_github("benjjneb/dada2", ref="v1.16")
Downloading GitHub repo benjjneb/dada2#v1.16
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?
1: All
2: CRAN packages only
3: None
4: RCurl (1.98-1.8 -> 1.98-1.9) [CRAN]
Enter one or more numbers, or an empty line to skip updates:
I update all old packages, which gives me the following:
GenomeInf... (NA -> 1.2.8 ) [CRAN]
RCurl (1.98-1.8 -> 1.98-1.9) [CRAN]
Installing 2 packages: GenomeInfoDbData, RCurl
There is a binary version available but the source version is
later:
binary source needs_compilation
RCurl 1.98-1.8 1.98-1.9 TRUE
installing the source packages ‘GenomeInfoDbData’, ‘RCurl’
trying URL 'https://bioconductor.org/packages/3.15/data/annotation/src/contrib/GenomeInfoDbData_1.2.8.tar.gz'
Content type 'application/x-gzip' length 11512907 bytes (11.0 MB)
downloaded 11.0 MB
trying URL 'https://cran.rstudio.com/src/contrib/RCurl_1.98-1.9.tar.gz'
Content type 'application/x-gzip' length 731611 bytes (714 KB)
downloaded 714 KB
The downloaded source packages are in
‘C:\Users\robinc4\AppData\Local\Temp\RtmpwR2WRF\downloaded_packages’
Error: Failed to install 'dada2' from GitHub:
! System command 'Rcmd.exe' failed
In addition: Warning messages:
1: In i.p(...) :
installation of package ‘GenomeInfoDbData’ had non-zero exit status
2: In i.p(...) : installation of package ‘RCurl’ had non-zero exit status
I'm not sure what is going wrong here, and my colleagues aren't too sure either... Has anyone here had a similar issue?
Thanks a lot in advance!

‘DelayedMatrixStats’ had non-zero exit status : Unable to install 'DelayedMatrixStats' (and failed to compile 'crayon' and 'HDF5Array')

Error: Unable to install 'DelayedMatrixStats' (and failed to compile 'crayon' and 'HDF5Array')
System: Windows 10 Pro, System type: 64-bit operating system, x64 based processor
R version 4.0.3 (2020-10-10), Rtools40 installed and placed into system path variables, Rstudio 1.4, Bioconductor Version 3.12 (BiocManager 1.30.10)
To reproduce error:
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install('DelayedMatrixStats')
Output:
Bioconductor version 3.12 (BiocManager 1.30.10), R 4.0.3 (2020-10-10)
Installing package(s) 'DelayedMatrixStats'
There is a binary version available but the source version is later:
binary source needs_compilation
DelayedMatrixStats 1.12.1 1.12.3 FALSE
installing the source package ‘DelayedMatrixStats’
trying URL 'https://bioconductor.org/packages/3.12/bioc/src/contrib/DelayedMatrixStats_1.12.3.tar.gz'
Content type 'application/x-gzip' length 271827 bytes (265 KB)
downloaded 265 KB
The downloaded source packages are in
‘C:\Users\bullo\AppData\Local\Temp\RtmpAr6ZPv\downloaded_packages’
Installation path not writeable, unable to update packages: boot, class, codetools, foreign, KernSmooth, Matrix, nlme, nnet, spatial
Old packages: 'crayon', 'HDF5Array'
Update all/some/none? [a/s/n]:
a
There are binary versions available but the source versions are later:
**binary source needs_compilation**
**crayon 1.4.0 1.4.1 FALSE**
**HDF5Array 1.18.0 1.18.1 TRUE**
installing the source packages ‘crayon’, ‘HDF5Array’
trying URL 'http://cran.rstudio.com/src/contrib/crayon_1.4.1.tar.gz'
Content type 'application/x-gzip' length 35769 bytes (34 KB)
downloaded 34 KB
trying URL 'https://bioconductor.org/packages/3.12/bioc/src/contrib/HDF5Array_1.18.1.tar.gz'
Content type 'application/x-gzip' length 8071706 bytes (7.7 MB)
downloaded 7.7 MB
The downloaded source packages are in
‘C:\Users\bullo\AppData\Local\Temp\RtmpAr6ZPv\downloaded_packages’
Warning messages:
1: In install.packages(...) : installation of package ‘DelayedMatrixStats’ had non-zero exit status
2: In install.packages(update[instlib == l, "Package"], l, repos = repos, : installation of package ‘crayon’ had non-zero exit status
3: In install.packages(update[instlib == l, "Package"], l, repos = repos, : installation of package ‘HDF5Array’ had non-zero exit status
Troubleshooting
It seemed my DelayedMatrixStats was not installing because of crayon and HDF5Array if I chose to update/compile them (I attempted to rerun without updating, but it still did not work)
Next, I tried rerunning just the installation of crayon using -- install.packages('crayon') and I also tried rerunning BiocManager::install("HDF5Array") and the compilation failed again. (The old binary versions are fine, but I need the updated versions for DelayedMatrixStats)
I also made sure to unclick the "Use secure download method for HTTP", restarted R, and tried rerunning install.packages('crayon') #non-zero exit status
I changed my CRAN mirror and still had a non-zero exit status with crayon
I then reinstalled R version 4 and Rstudio and Rtools40 (plus re-added to path) #crayon still failed and had non-zero exit status
Uninstalled everything and deleted all connected files, then reinstalled R version 3.6.1, RStudio, and Rtools 3.5 (added to path) #crayon still failed and had non-zero exit status
Other things I've tried to install crayon which both gave me a non-zero exit status:
install.packages('crayon', dependencies = TRUE)
install.packages('https://cran.r-project.org/src/contrib/crayon_1.4.1.tar.gz', repos = NULL)
DelayedMatrixStats, crayon, and HDF5Array have not been successfully installed, and continue to give me trouble.

How to install caret package. Tried install.packages("caret") but getting error

After install.packages("caret") getting below error:
Installing package into ‘...../R/win-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘rlang’, ‘recipes’
There are binary versions available but the source versions are later:
binary source needs_compilation
rlang 0.3.4 0.4.0 TRUE
recipes 0.1.5 0.1.6 FALSE
caret 6.0-81 6.0-84 TRUE
Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/rlang_0.3.4.zip'
Content type 'application/zip' length 1080437 bytes (1.0 MB)
downloaded 1.0 MB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/caret_6.0-81.zip'
Content type 'application/zip' length 5392174 bytes (5.1 MB)
downloaded 5.1 MB
package ‘rlang’ successfully unpacked and MD5 sums checked
Warning in install.packages :
cannot remove prior installation of package ‘rlang’
package ‘caret’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
.........\Temp\RtmpkJG4l1\downloaded_packages
installing the source package ‘recipes’
trying URL 'https://cran.rstudio.com/src/contrib/recipes_0.1.6.tar.gz'
Content type 'application/x-gzip' length 968331 bytes (945 KB)
downloaded 945 KB
ERROR: dependency 'rlang' is not available for package 'recipes'
* removing 'C:/Users/PBiradarP/Documents/R/win-library/3.4/recipes'
In R CMD INSTALL
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-34~1.4/bin/x64/R" CMD INSTALL -l "......\R\win-library\3.4"
...../Temp\RtmpkJG4l1/downloaded_packages/recipes_0.1.6.tar.gz' had status 1
Warning in install.packages :
installation of package ‘recipes’ had non-zero exit status
I have tried and installed "rlang" package also. Its dependent on "recepies" package so again downloaded that too...
getting this message after installing this.
:Warning in install.packages :
package ‘recepies’ is not available (for R version 3.4.4)
I need to load caret package to be installed.
If you are using Windows, try this:
Add your library to libpaths; see this answer. After that try installing packages; see this answer:
install.packages("caret", dependencies=TRUE, type="win.binary")

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

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.

Cannot install twitteR package

Im trying to install the package twitteR in RStudio but I am getting errors with the dependencies of DBI package and so the installation of twitteR isn't completed.
Here is the error....I hope someone can help out.
install.packages("twitteR")
>Installing package into ‘D:/Users/vijhaver/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
also installing the dependency ‘DBI’
> There is a binary version available but the source version is later:
binary source needs_compilation
DBI 0.3.1 0.4 FALSE
>trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/twitteR_1.1.9.zip'
Content type 'application/zip' length 446779 bytes (436 KB)
downloaded 436 KB
>package ‘twitteR’ successfully unpacked and MD5 sums checked
>The downloaded binary packages are in
C:\Users\vijhaver\AppData\Local\Temp\RtmpacWdm7\downloaded_packages
installing the source package ‘DBI’
>trying URL 'https://cran.rstudio.com/src/contrib/DBI_0.4.tar.gz'
Content type 'application/x-gzip' length 141460 bytes (138 KB)
downloaded 138 KB
>'D:\Program' is not recognized as an internal or external command,
operable program or batch file.
Warning in install.packages :
running command '"D:/Program Files/R/R-3.2.1/bin/x64/R" CMD INSTALL -l "D:\Users\vijhaver\Documents\R\win-library\3.2" C:\Users\vijhaver\AppData\Local\Temp\RtmpacWdm7/downloaded_packages/DBI_0.4.tar.gz' had status 1
Warning in install.packages :
installation of package ‘DBI’ had non-zero exit status
>The downloaded source packages are in
‘C:\Users\vijhaver\AppData\Local\Temp\RtmpacWdm7\downloaded_packages’
Warning messages:
1: In .HTMLsearch(query) : Unrecognized search field: title
2: In .HTMLsearch(query) : Unrecognized search field: keyword
3: In .HTMLsearch(query) : Unrecognized search field: alias

Resources