install_github(): "system error 267, The directory name is invalid" - r

I am trying to install package performance development version with devtools but am getting this error:
> devtools::install_github("easystats/performance")
Downloading GitHub repo easystats/performance#HEAD
Error: Failed to install 'performance' from GitHub:
create process 'C:/PROGRA~1/R/R-40~1.3/bin/x64/Rcmd.exe' (system error 267, The directory name is invalid.
) #win/processx.c:1040 (processx_exec)
Same thing with alternative remotes command:
> remotes::install_github("easystats/performance")
Downloading GitHub repo easystats/performance#HEAD
Error: Failed to install 'performance' from GitHub:
create process 'C:/PROGRA~1/R/R-40~1.3/bin/x64/Rcmd.exe' (system error 267, The directory name is invalid.
) #win/processx.c:1040 (processx_exec)
Edit: Note that I am getting the same error no matter what package I've tried to install through devtools (e.g., cardiomoon/processR or r-lib/crayon). This started to happen suddenly a few weeks ago yet never had this issue before. So it seems not related to the package but to something else.
So I tried changing my default library to the simplest ever location that doesn't have any special characters or require any admin rights, with those instructions. I can confirm that C:/Rpackages is now indeed my default library path, and that it is first (on the left):
> .libPaths()
[1] "C:/Rpackages" "C:/Program Files/R/R-4.0.3/library"
However, I am still getting the same error. The weird thing is that the error still seems to refer to the second library path rather than the first one, which seems off to me. From the help documentation, I don't see how to specify the library location explicitly for neither devtools nor remotes. Also interesting, notice that the error seems to mention R-40~1.3 instead of R-4.0.3 as it should(?). Might this be the issue? Then how to fix?
I also tried reinstalling devtools and remotes, to no avail.
Yet, it works if I install the regular CRAN version:
> install.packages("performance")
Installing package into ‘C:/Rpackages’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/performance_0.7.2.zip'
Content type 'application/zip' length 2487172 bytes (2.4 MB)
downloaded 2.4 MB
package ‘performance’ successfully unpacked and MD5 sums checked
Here my session info if useful:
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=English_Canada.1252 LC_CTYPE=English_Canada.1252
[3] LC_MONETARY=English_Canada.1252 LC_NUMERIC=C
[5] LC_TIME=English_Canada.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.3 tools_4.0.3 yaml_2.2.1

The issue was with the processx package and the development version has since received a fix (in version v3.5.3). Please see the following discussion for more info: https://github.com/r-lib/processx/issues/313

Related

R Unable to Install Packages From GitHub (System Error 267 #win/processx.c:1040)

TL;DR
Unable to install any package from GitHub, System Error 267
I've newly setup R (v4.1), Rstudio and just installed devtools.
I also additionally installed Rtools40 and added it to my path (global environment)
Rtools seems to work properly as validated with: Sys.which("make") & maketools::rtools_find() (output below)
Problem
I am unable to install any package from GitHub, e.g. rstudio/gt. The error is nearly identical for any GitHub Package, allways stating system error 267
devtools::install_github("rstudio/gt")
Downloading GitHub repo rstudio/gt#HEAD
Error: Failed to install 'gt' from GitHub:
create process 'C:/PROGRA~1/R/R-41~1.0/bin/x64/Rcmd.exe' (system error 267, Der Verzeichnisname ist ungültig.
) #win/processx.c:1040 (processx_exec
Update
As suggested I reinstalled R 4.1.0 to the most simple folde possible C:/R/
The error ist still the same despite now lacking tildes ~
devtools::install_github("rstudio/gt")
Downloading GitHub repo rstudio/gt#HEAD
Error: Failed to install 'gt' from GitHub:
create process 'C:/R/bin/x64/Rcmd.exe' (system error 267, Der Verzeichnisname ist ungültig.
) #win/processx.c:1040 (processx_exec)
Update 2:
Changed the .libPaths to a folder without any special characters
.libPaths( c( "D:/tmp" , .libPaths() ) )
.libPaths()
[1] "D:/tmp" "C:/Users/Björn/Documents/R/win-library/4.1"
[3] "C:/R/library"
Error is still the same
Update 3:
I updated some packages, and checked the version of packageVersion('processx')= 3.5.2
install.packages("testthat")
install.packages("pkgload")
install.packages("devtools")
install.packages("remote")
Content of Sys.getenv
Sys.getenv('Path')
[1] "C:\\rtools40\\usr\\bin;C:\\R\\bin\\x64;C:\\rtools40\\usr\\bin;C:\\rtools40\\mingw64\\bin;
Diagnostics
Session Info
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
Rtools successful installed / setup
Sys.which("make")
make
"C:\\rtools40\\usr\\bin\\make.exe"
maketools::rtools_find()
$version
[1] ‘4.0’
$compiler
[1] "gcc 8.3.0"
$api
[1] ‘8’
$PATH
[1] "C:\\rtools40\\usr\\bin"
$BINPREF
[1] "C:/rtools40/mingw$(WIN)/bin/"
$available
[1] TRUE
$compatible
[1] TRUE
The standalone mode of the remotes package solved the issue for me,
as suggested by the maintainer of processx (Gábor Csárdi) here
devtools::install_github() only calls remotes::install_github().
However, for the remotes, there is the option to be exectued in standalone mode
Source: Cran
Standalone mode
remotes will use the curl, git2r and pkgbuild packages if they are
installed to provide faster implementations for some aspects of the
install process. However if you are using remotes to install or update
these packages (or their reverse dependencies) using them during
installation may fail (particularly on Windows).
If you set the environment variable R_REMOTES_STANDALONE="true" (e.g.
in R Sys.setenv(R_REMOTES_STANDALONE="true")) you can force remotes to
operate in standalone mode and use only its internal R
implementations. This will allow successful installation of these
packages
With the following lines of code, gt was finally successfull installed from github.
Sys.setenv(R_REMOTES_STANDALONE="true")
remotes::install_github("rstudio/gt")
Thanks all the commentators for your help!
Update October / 2021
To avoid having to do these steps (Set in standanlone mode, and install with remotes) over and over again everytime you want to install a new package from github another convenient workaround is to just rollback to the previous version of processx as adviced by #rempsy in the github issue:
install.packages("pacman")
pacman::p_del(processx)
# Installing previous verison 3.5.1
install.packages("https://cran.r-project.org/src/contrib/Archive/processx/processx_3.5.1.tar.gz", repos=NULL, type="source")
After the rollback of processx to version 3.5.1, devtools::install_github() works as expected, e.g.
devtools::install_github("rstudio/gt")

R: Internet routines cannot be loaded after update to R4.0

I have an issue that is stumping me and am looking for some help. I just upgraded to R 4.0 and am trying to reinstall packages. This produces the following warning messages:
Warning: failed to download mirrors file (internet routines cannot be loaded); using local file 'C:/PROGRA~1/R/R-40~1.0/doc/CRAN_mirrors.csv'
Warning: unable to access index for repository https://cran.uni-muenster.de/src/contrib:
internet routines cannot be loaded
Warning: unable to access index for repository https://cran.uni-muenster.de/bin/windows/contrib/4.0:
internet routines cannot be loaded
Warning messages:
1: In download.file(url, destfile = f, quiet = TRUE) :
unable to load shared object 'C:/PROGRA~1/R/R-40~1.0/modules/x64/internet.dll':
LoadLibrary failure: Access is denied.
2: package ‘dplyr’ is not available (for R version 4.0.)
Note, the LoadLibrary failure is not always present. Additionally, when I look for help on a function (e.g. ?download.file), I get the following error message:
starting httpd help server ...Error in startDynamicHelp(TRUE) : internet routines cannot be loaded
So, it seems like there is a general issue with R connecting to the internet, but I'm not sure how to go about fixing this. This happens in both RStudio (which is fully updated) and in the base RGui; additionally, I do have access and permissions to read/write in the C:/PROGRA~1/R/R-40~1.0/modules/x64/ folder. Any help here would be much appreciated!
Edit:
Posting my sessionInfo() in case that is helpful:
> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)
Matrix products: default
Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.0 tools_4.0.0
Edit 2: I have done some more digging and the 32-bit version of R works just fine, while the 64-bit does not.
i had the same issue when updated to R 4.0.2 64-bit and ran in RStudio 1.4.xxx which reported internet routine not loaded. my work cylance protect antivirus quarantined internet.dll file under modules\x64\internet.dll. I reported to my IT today. they said that this dll file is asking which antivirus installed in my machine. so, my IT was concerned. my IT will ask cylance.
My IT advised me not to download R 402 from cran where it was infected.
i copied that dll from my another pc where R 363 installed and put there.
but cylance antivirus quarantined again.
so i bring my covid analysis file home and am doing with my home R 402.
I checked downloaded R 402 and internet.dll with my windows defender = all clean
the most probable cause = my IT security perceived threat from internet.dll
wondering what others are thinking about it.
I also discussed with my IT director for having r package mirror server so i can download without going to the internet.
cheers.
Install RStudio and R Version With help of IT Team.
Download New Version of R from CRAN
Copy an internet.dll file (which Size should be Up to 5MB) from Existing Version Installed by IT Team on Your System
C:\Program Files\R\R-4.0.3\modules\x64 and
Paste it to C:\Users\MyUser\Documents\R\R-4.1.2\modules\x64 folder of New version
Then Restart RStudio you will not get any error
also you can install any packages
Do not need to make changes into any File like Rprofile and Renv
Or any other Options() Functions
Note: The File Path may be different in your System

R Error when installing/loading packages from library on company pc

After opening R Studio the following Error-message appears:
This error also always appears in the end when I am trying to install or load packages:
Error: invalid version specification ‘NA’
In addition: Warning message:
In utils:::packageDescription(packageName, fields = "Version") :
no package 'knitr' was found
Some maybe helpful facts:
> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.1 tools_3.5.1
I am working on a company laptop without admin-rights, why I have set my library path manually to the following writable folders:
> .libPaths()
[1] "\\\\HOME.COMPANYNAME/USERNAME$/Files/R/win-library/3.5"
[2] "\\\\HOME.COMPANYNAME/USERNAME$/Files/R/R-3.5.1/library"
The second .libPath() was created automatically some weeks after the first.
I cannot manually delete both .libPaths from my laptop due to missing admin-rights.
I also tried to remove the libraries as recommended in several posts
with:
R_LIBS=C:/Program Files/R/R-2.15.2/library
Nevertheless, the .libPaths stayed the same after this:
> .libPaths()
[1] "\\\\HOME.COMPANYNAME/USERNAME$/Files/R/win-library/3.5"
[2] "\\\\HOME.COMPANYNAME/USERNAME$/Files/R/R-3.5.1/library"
I also tried setting a new .libPath on a local folder C:// :
.libPaths("C:\\Users\\USERID\\Desktop\\R")
After that, the first .libPath is replaced by the new local one, while the second .libPath stays the same and I am getting the same error again:
> .libPaths()
[1] "C:/Users/USERID/Desktop/R"
"\\\\HOME.COMPANYNAME/USERNAME$/Files/R/R-3.5.1/library"
Error: invalid version specification ‘NA’
In addition: Warning message:
In utils:::packageDescription(packageName, fields = "Version") :
no package 'knitr' was found
Setting the new .libPath on the local folder C:/ allows me to install and load packages but only temporarly within the R Studio-session:
> install.packages("FDboost")
Installing package into ‘C:/Users/USERID/Desktop/R/R-3.5.1/library’
(as ‘lib’ is unspecified)
After quitting and restarting the R session, the newly defined .libPath on C:/ as well as the installed packages are deleted.
Maybe I have to add the .libPath to the filepath as recommended by #r2evans so that it is saved also after quitting the R session? I did not figure out how to do so...
For the last months, I was able to install and load packages from these two library paths, maybe there was an antivirus update that now makes problems? I did not change any settings but it seems like R cannot find or edit the installed packages anymore.
Deinstalling R or RStudio is not a possible solution, since I need admin rights to reinstall them.
Since other posts did not bring the solution so far, maybe anybody has more ideas?

Trouble installing BH on R [duplicate]

I cannot install the R-package BH which I need only to install dplyr afterwards.
The download works but something is wrong with the processing afterwards, as there is no reaction or progress whatsoever. Installation of lubridate (and deinstallation of lubridate) in contrast worked smoothly without any problems.
My output is:
> install.packages("BH")
Installing package into ‘.../R/win-library/3.2’
(as ‘lib’ is unspecified)
versuche URL 'http://cran.univ-paris1.fr/bin/windows/contrib
/3.2/BH_1.58.0-1.zip'
Content type 'application/zip' length 13846684 bytes (13.2 MB)
downloaded 13.2 MB
and then nothing happens.
Any ideas what could be causing this behavior? Are there any prerequisites for the installation of BH?
> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
BH, as a sizeable subset of Boost Headers is big, as in really big:
edd#max:~$ du -csm /usr/local/lib/R/site-library/BH/
111 /usr/local/lib/R/site-library/BH/
111 total
edd#max:~$
That is 111 megabytes.
You may simply have run our of patience if your Windows (network share ?) was slow in writing the files.
BH is also widely used by other CRAN packages, and there has not been a package on any of the platforms used by CRAN.
So I suggest you maybe place your R package library onto a local hard drive...
If you have an actual bug report, please consider filing an issue ticket against our BH package.
I had this problem -- there were two parts to my fix.
1/ Download the windows binary from CRAN and save to the hard disk. You then select the menu item: Packages >> Install package(s) from local files…
2/ Edit the utils:::unpackPkgZip function to increase the sleep time – so that my virus checker has time to scan it. To implement this, do the following:
trace(utils:::unpackPkgZip, edit=TRUE)
Look for the line Sys.sleep(0.5), toward the bottom of the body of the function; it's a big package so I went for Sys.sleep(10).
If you are still seeing the error: Warning: unable to move temporary installation, try a longer sleep period.
Note that you won't see the edit if you check utils:::unpackPkgZip; that is the unedited version, and it can be restored via untrace(utils:::unpackPkgZip).
So see the edited version, use body(utils:::unpackPkgZip).

R TCLTK not loading on windows

I have installed R on countless windows machines and never had a problem with the tcltk package until now.
I have freshly installed R 3.3.2 onto Windows 10 Pro v1607 and can't load tcltk. I used the windows install binaries from CRAN, so no custom builds.
capabilities("tcltk")
returns TRUE. When I try to load tcltk:
library("tcltk")
I get:
Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'C:/Program Files/R/R-3.3.2/library/tcltk/libs/x64/tcltk.dll':
LoadLibrary failure: The specified module could not be found.
Error: package or namespace load failed for ‘tcltk’
Navigating to the location of the DLL confirms that it is there. This fails when calling both x64 and i386 versions of R. I have tried running as admin and same thing. I also tried rolling back to version 3.3.1 and had the same issues.
This PC has an AMD FX-8120 processor.
I couldn't find much on R tcltk problems on Windows. Any ideas would be great.
Cheers
EDIT: added info:
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.3.2
To fix the problem do the following tests:
Test the Tcl/Tk installation of R:
Find and start wish85.exe which is contained in one of the sub folders of the R installation ("85" is the version number and my differ depending on your R version).
An empty Tk window must pop up and a tcl/tk console must open.
If not the installation is damaged or parts have been deleted
(reinstall it)
Check if R is using the right Tcl/Tk version:
Check the value of the environment variable MY_TCLTK
If it is defined: Does the path point to the bin folder of Tcl/Tk?
If not: Fix it.
If it is not defined: It should work out of the box but you could
set the value to the bin folder.
Source:
https://mirrors.dotsrc.org/cran/bin/windows/base/rw-FAQ.html#Package-TclTk-does-not-work_002e
MY_TCLTK was defined as "Yes" in my environment variables. I changed it to the location of the tcl exe that was installed with R and it works now.

Resources