mike44
February 24, 2021, 1:34am
1
I have R 4.0.3 installed in RStudio on Windows 10 Pro
I followed the rstan website installation procedure
I tried to install rstan using the following command:
install.packages(c("StanHeaders", "rstan"), type = "source")
I get the following error:
*** arch - i386
g++ -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -I"…/inst/include" -I"…/inst/include/boost_not_in_BH" -I"." -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -DBOOST_NO_AUTO_PTR -DSTAN_THREADS -DRCPP_PARALLEL_USE_TBB=1 -I’D:/PG/OneDrive - icx.com/Documents/R/win-library/4.0/Rcpp/include ’ -I’D:/PG/OneDrive - icx.com/Documents/R/win-library/4.0/RcppEigen/include ’ -I’D:/PG/OneDrive - icx.com/Documents/R/win-library/4.0/BH/include ’ -I’D:/PG/OneDrive - icx.com/Documents/R/win-library/4.0/StanHeaders/include ’ -I’D:/PG/OneDrive - icx.com/Documents/R/win-library/4.0/RcppParallel/include ’ -DRCPP_PARALLEL_USE_TBB=1 -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -mtune=native -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -c sparse_extractors.cpp -o sparse_extractors.o
sh: g++: command not found
make: *** [C:/PROGRA~1/R/R-40~1.3/etc/i386/Makeconf:229: sparse_extractors.o] Error 127
ERROR: compilation failed for package ‘rstan’
I have the following in my Makevars.win file:
CXX14FLAGS += -mtune=native -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2
CXX14 = C:/Rtools40/mingw64/bin
PKG_LIBS=$(GRAPHAPP_LIB)
I checked and g++.exe resides in the folder C:/Rtools40/mingw64/bin and as you see I already have this path in my Makevars.win file.
I tried to remove rstan and StanHeaders to re-install but there was nothing to remove.
So, why do I get this error message? and if there is any solution?
Can you remove the CXX14 =
line in your Makevars and try again? You don’t need that with R4.0.
Additionally, can you post the output from:
readLines("~/.Renviron")
mike44
February 24, 2021, 2:25am
3
I deleted the line and restarted the session, and tried to install StanHeaders and rstan. The same error comes up.
When I run the readLines("~/.Renviron"), I get:
“PATH=”{RTOOLS40_HOME}\\usr\\bin; {PATH}""
What do you get from:
Sys.which("make")
Are you able to install any packages from source:
install.packages("jsonlite",type="source")
mike44
February 24, 2021, 2:57am
5
Sys.which(“make”)
make
“C:\rtools40\usr\bin\make.exe”
When I run the json install command, I get:
Installing package into ‘D:/PG/OneDrive - icx.com/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL ‘https://cran.rstudio.com/src/contrib/jsonlite_1.7.2.tar.gz ’
Content type ‘application/x-gzip’ length 421716 bytes (411 KB)
downloaded 411 KB
ERROR: failed to lock directory ‘D:/PG/OneDrive - icx.com/Documents/R/win-library/4.0 ’ for modifying
Try removing ‘D:/PG/OneDrive - icx.com/Documents/R/win-library/4.0/00LOCK-jsonlite ’
Warning in install.packages :
installation of package ‘jsonlite’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\GP\AppData\Local\Temp\RtmpAdyaYj\downloaded_packages’
One thing maybe a problem, I have my system files on C drive and my document files on D drive. These are two local hard disks. Is this causing an issue?
Can you pause the sync for your OneDrive and then try again?
mike44
February 24, 2021, 3:03am
7
I did stop the sync, re-started the session, and then again ran:
install.packages(c(“StanHeaders”, “rstan”), type = “source”)
I get the same error message.
I meant try installing the jsonlite
package from source again. We need to make sure that you’re properly configured with a simple package before trying something more complex like rstan
mike44
February 24, 2021, 3:06am
9
I get the same message, shown below.
Installing package into ‘D:/PG/OneDrive - icx.com/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL ‘https://cran.rstudio.com/src/contrib/jsonlite_1.7.2.tar.gz ’
Content type ‘application/x-gzip’ length 421716 bytes (411 KB)
downloaded 411 KB
ERROR: failed to lock directory ‘D:/PG/OneDrive - icx.com/Documents/R/win-library/4.0 ’ for modifying
Try removing ‘D:/PG/OneDrive - icx.com/Documents/R/win-library/4.0/00LOCK-jsonlite ’
Warning in install.packages :
installation of package ‘jsonlite’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\GP\AppData\Local\Temp\Rtmp6Di1Cp\downloaded_packages’
Can you delete the folder they mentioned:
Try removing ‘D:/PG/OneDrive - icx.com/Documents/R/win-library/4.0/00LOCK-jsonlite’
And try again?
mike44
February 24, 2021, 3:18am
11
I deleted the 00LOCK-jsonlite directory and installed the jsonlite from the comment above
no error message
Great, that means your toolchain is all setup. Can you then run the rstan install again and post the error output?
mike44
February 24, 2021, 3:25am
13
*** arch - i386
g++ -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -I"…/inst/include" -I"…/inst/include/boost_not_in_BH" -I"." -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -DBOOST_NO_AUTO_PTR -DSTAN_THREADS -DRCPP_PARALLEL_USE_TBB=1 -I’D:/PG/OneDrive - icx.com/Documents/R/win-library/4.0/Rcpp/include ’ -I’D:/PG/OneDrive - icx.com/Documents/R/win-library/4.0/RcppEigen/include ’ -I’D:/PG/OneDrive - icx.com/Documents/R/win-library/4.0/BH/include ’ -I’D:/PG/OneDrive - icx.com/Documents/R/win-library/4.0/StanHeaders/include ’ -I’D:/PG/OneDrive - icx.com/Documents/R/win-library/4.0/RcppParallel/include ’ -DRCPP_PARALLEL_USE_TBB=1 -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -mtune=native -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -c sparse_extractors.cpp -o sparse_extractors.o
sh: g++: command not found
make: *** [C:/PROGRA~1/R/R-40~1.3/etc/i386/Makeconf:229: sparse_extractors.o] Error 127
ERROR: compilation failed for package ‘rstan’
The downloaded source packages are in
‘C:\Users\GP\AppData\Local\Temp\Rtmp6Di1Cp\downloaded_packages’
Alright, so if it’s working for jsonlite
but not rstan
, then there’s some configuration specific to c++/g++ that’s getting in the way.
To get more info about your system, can you post the output from:
readLines("~/.Rprofile")
Sys.getenv("BINPREF")
Sys.getenv("PATH")
mike44
February 24, 2021, 3:33am
15
now there is no .Rprofile exist any more
readLines(“~/.Rprofile”)
Error in file(con, “r”) : cannot open the connection
In addition: Warning message:
In file(con, “r”) :
cannot open file ‘D:/PG/OneDrive - icx.com/Documents/.Rprofile ’: No such file or directory
Sys.getenv(“BINPREF”)
[1] “”
Sys.getenv(“PATH”)
[1] “C:\rtools40\usr\bin;C:\Program Files\R\R-4.0.3\bin\x64;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\SAS\SharedFiles(32)\Formats;C:\Program Files\MATLAB\R2020b\bin;C:\Users\GP\AppData\Local\Microsoft\WindowsApps”
Hmm nothing there, what about from:
Sys.which("g++")
readLines("~/.R/Makevars.win")
Ah there it is. Can you delete the entire CXX14
line, you don’t need to specify this at all.
mike44
February 24, 2021, 3:38am
19
delete both line #2 and #3 above?