Hi, I’m still getting a similar error after I finally got the previous one fixed (New error: cleanup_makevar(old) : argument "RMU" is missing, with no default - #42 by jonah)
So now, I get this:
Error in compileCode(f, code, language = language, verbose = verbose) :
sh: g++: command not foundmake: *** [C:/PROGRA~1/R/R-40~1.3/etc/x64/Makeconf:229: file1220515e66f3.o] Error 127
Error in sink(type = “output”) : invalid connection
I’m working on Windows with Rstudio version 4 and I just updated all my packages to make sure I had the latest version of everything. I’m strying to run a brm model with the brms package.
The Error in sink(type = "output") : invalid connection error went away and things started working again after a complete reinstall of my RStudio to the 1.4.1106 version, R to 4.0.4, reinstallation of all the packages, and installing rstan from source like remotes::install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan"). Now, I have new warnings 'config' variable 'CPP' is deprecated and clang -mmacosx-version-min=10.13 -E. But according to this thread, it seems like this isn’t something to worry about too much.
Hi,
many thanks,
sorry for the late reply.
Looks like he is unable to locate some files!
I’ll also be re installing R to version 4.0.4 as suggested by arpasan, I’m apparently still on 4.0.3
Sys.getenv(“BINPREF”)
[1] “”
Sys.getenv(“PATH”)
[1] “C:\Program Files\Rtools\usr\bin;C:\Program Files\Rtools\usr\bin;C:\Program Files\R\R-4.0.3\bin\x64;C:\Program Files (x86)\Common Files\Oracle\Java\javapath_target_19479906;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Matlab\R2020b\runtime\win64;C:\Program Files\Matlab\R2020b\bin;C:\Program Files\Git\cmd;D:\Users\kardpauw\AppData\Local\Microsoft\WindowsApps”
readLines(“~/.R/Makevars.win”)
Error in file(con, “r”) : cannot open the connection
In addition: Warning message:
In file(con, “r”) :
cannot open file ‘D:/Users/kardpauw/Documents/.R/Makevars.win’: No such file or directory
readLines(“~/.Renviron”)
[1] “PATH="{RTOOLS40_HOME}\\usr\\bin;{PATH}"” “PATH="{RTOOLS40_HOME}\\usr\\bin;{PATH}"”
readLines(“~/.Rprofile”)
Error in file(con, “r”) : cannot open the connection
In addition: Warning message:
In file(con, “r”) :
cannot open file ‘D:/Users/kardpauw/Documents/.Rprofile’: No such file or directory
I think the issue is that you’ve installed RTools in a non-standard directory, so R is looking in the wrong place. We just need to tell R where to look.
I’m not sure about the Rtools4, do you mean Rtools40?
I don’t think my Rtools is Rtools40, as it should show in the sys.which(“make”) I think.
Does it come automatically with newest versions of R or Rstudio, or do I install it separately?
In that case try running through the RStan installation instructions. Also make sure that you uninstall any other versions of RTools on your system, just to be sure
I installed the new rtools and reinstalled the new versions of R and Rstudio, plus then got stan and stanheaders again from github. And now my models are running again!
Thank you so much!!
Sorry for not just following the right instructions!
Hi, I’m new to Stan. I’ve searched and attempted several times to resolve the same issue as the headline of this post, but I’m still having the below error. Any help is greatly appreciated.
Compilation ERROR, function(s)/method(s) not created! Error in compileCode(f, code, language = language, verbose = verbose) : **
** sh: line 1: g++: command not foundmake: *** [C:/PROGRA~1/R/R-4.0.2/etc/x64/Makeconf:229: file12a440014c6d.o] Error 127
In addition: Warning messages:
1: package ‘rstan’ was built under R version 4.0.5
2: In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘C:/rtools40/usr/mingw_/bin/g++’ not found
Thank you so much for your reply. I get the following:
Sys.getenv(“PATH”)
[1] “C:\rtools40\usr\bin;C:\Program Files\R\R-4.0.2\bin\x64;C:\Program Files (x86)\Common Files\Oracle\Java\javapath_target_1185922296;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\MiKTeX\miktex\bin\x64;C:\Program Files\MATLAB\R2020a\bin;C:\Users\elnaz\AppData\Local\Microsoft\WindowsApps;C:\Users\elnaz\AppData\Roaming\TinyTeX\bin\win32”
readLines(“~/.Renviron”)
[1] “PATH="{RTOOLS40_HOME}\\usr\\bin;{PATH}"”
readLines(“~/.Rprofile”)
Error in file(con, “r”) : cannot open the connection
In addition: Warning message:
In file(con, “r”) :
cannot open file ‘C:/Users/elnaz/Documents/.Rprofile’: No such file or directory
file.exists(“C:/rtools40/mingw64/bin/g++.exe”)
[1] TRUE
restoring previous ‘C:/Users/elnaz/Documents/R/win-library/4.0/jsonlite’
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) :
problem copying C:\Users\elnaz\Documents\R\win-library\4.0\00LOCK-jsonlite\jsonlite\libs\x64\jsonlite.dll to C:\Users\elnaz\Documents\R\win-library\4.0\jsonlite\libs\x64\jsonlite.dll: Permission denied
Warning in install.packages :
installation of package ‘jsonlite’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\elnaz\AppData\Local\Temp\Rtmp6NjJi0\downloaded_packages’