Hi,
I am new to rstan. The installation was successfully done within Windows10, in C:
However, when I try to run the first model after the installation instructions, I get the following error message:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! file27b46fc111f7.cpp:8:39: fatal error: stan/model/model_header.hpp: No such file or directory #include <stan/model/model_header.hpp>
^
compilation terminated.
make: *** [C:/PROGRA~1/R/R-36~1.2/etc/x64/Makeconf:215: file27b46fc111f7.o] Error 1
In addition: Warning message:
In system(cmd, intern = !verbose) :
running command ‘C:/PROGRA~1/R/R-36~1.2/bin/x64/R CMD SHLIB file27b46fc111f7.cpp 2> file27b46fc111f7.cpp.err.txt’ had status 1
Error in sink(type = “output”) : invalid connection
I had a look at the other similar posts, (re-installation, installing in C:) but they have not worked for me. Any advise would be most appreciated.
Both of these error messages are saying it cannot find files that are in packages that are installed in your home directory. I think you need to figure out a way to install packages somewhere in C:/. Or maybe map the network drive your home directory is on to some place in C:/ or at least that has the same conventions for specifying paths.
Hi! Sorry to hijack this thread, but I’m running into a similar problem. If you prefer I open a new thread, please let me know.
When trying to compile a Stan model I get the following error:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! file339c2b2f763d.cpp:31:40: error:
expected template-name before '<' token
: public stan::model::model_base_crtp<model339c3e6c6dd_8b930d0c26abd40c299b4f2a09342bab> {
^
file339c2b2f763d.cpp:31:40: error: expected '{' before '<' token
file339c2b2f763d.cpp:31:40: error: expected unqualified-id before '<' token
In file included from J:/Documents/R/win-library/3.6/BH/include/boost/winapi/time.hpp:13:0,
from J:/Documents/R/win
library/3.6/BH/include/boost/date_time/microsec_time_clock.hpp:24,
from J:/Documents/R/win-
library/3.6/BH/include/boost/date_time/posix_time/posix_time_types.hpp:11,
from J:/Documents/R/win-library/3.6/rstan/include/rstan/stan_fit.hpp:13,
from J:/Documents/R/win-library/3.6/rstan/include/rstan/rstaninc.hpp:3,
from file339c2b2f763d.cpp:520:
J:/Documents/R/win-library/3.6/BH/include
In addition: Warning message:
In system(cmd, intern = !verbose) :
running command 'C:/PROGRA~1/R/R-36~1.2/bin/x64/R CMD SHLIB file339c2b2f763d.cpp 2>
file339c2b2f763d.cpp.err.txt' had status 1
Error in sink(type = "output") : invalid connection
I’m not quite sure what’s going wrong, although it seems similar to the problem described here. I’m able to run
I think the easiest thing to do would be to install the rstan that goes with that version of StanHeaders. But things with CRAN are a bit in flux at the moment, so you have to do
Thanks! I tried but unfortunately run into a new problem:
Error: package or namespace load failed for ‘rstan’ in inDL(x, as.logical(local), as.logical(now), ...):
unable to load shared object 'J:/Documents/R/win-library/3.6/rstan/libs/x64/rstan.dll':
LoadLibrary failure: The specified procedure could not be found.
In addition: Warning message:
package ‘rstan’ was built under R version 4.0.0
Sadly I’m having some trouble getting that to compile from source. Variations of the errors and warnings I see all the time are:
J:/Documents/R/win-library/3.6/StanHeaders/include/stan/math/prim/scal/meta/require_generics.hpp:736:53: warning: variadic
templates only available with -std=c++11 or -std=gnu++11
template <template <class...> class TypeCheck, class... Check>
^
J:/Documents/R/win-library/3.6/StanHeaders/include/stan/math/prim/scal/meta/require_generics.hpp:737:1: error: expected
unqualified-id before 'using'
using require_all_not_std_vector_st
^
And it ends with
make: *** [C:/PROGRA~1/R/R-36~1.2/etc/i386/Makeconf:215: sparse_extractors.o] Error 1
ERROR: compilation failed for package 'rstan'
* removing 'J:/Documents/R/win-library/3.6/rstan'
* restoring previous 'J:/Documents/R/win-library/3.6/rstan'
Error: Failed to install 'rstan' from GitHub:
(converted from warning) installation of package
‘C:/Users/maum/AppData/Local/Temp/RtmpIXM05M/file3e88678f6169/rstan_2.21.1.tar.gz’ had non-zero exit status
In addition: Warning message:
In utils::untar(tarfile, ...) :
‘tar.exe -xf "C:\Users\maum\AppData\Local\Temp\RtmpIXM05M\file3e886f114dd6.tar.gz" -C
"C:/Users/maum/AppData/Local/Temp/RtmpIXM05M/remotes3e88eac4bec"’ returned error code 1
Unfortunately I have no idea what these errors mean - any advice is greatly appreciated.
P.S. the installation errors and warnings go on for multiple screens - let me know if you want me to capture them entirely.
Hold on, for whatever reason, using rstan 2.19.2 with StanHeaders 2.21.0-1 is now working (mostly) as expected. I’ll do some more testing, but if you don’t hear from me, please don’t spend any time on this anymore! :-)
Unfortunately I seem to have celebrated a bit too early. Some of the simpler Stan models (i.e. 8 schools) compile and sample just fine, but a slightly more complex model gives this error:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created!
C:\Users\maum\AppData\Local\Temp\cc553bQO.s: Assembler messages:
C:\Users\maum\AppData\Local\Temp\cc553bQO.s:8510: Error: invalid register for .seh_savexmm
C:\Users\maum\AppData\Local\Temp\cc553bQO.s:8512: Error: invalid register for .seh_savexmm
C:\Users\maum\AppData\Local\Temp\cc553bQO.s:17711: Error: invalid register for .seh_savexmm
C:\Users\maum\AppData\Local\Temp\cc553bQO.s:88036: Error: invalid register for .seh_savexmm
C:\Users\maum\AppData\Local\Temp\cc553bQO.s:88038: Error: invalid register for .seh_savexmm
C:\Users\maum\AppData\Local\Temp\cc553bQO.s:88040: Error: invalid register for .seh_savexmm
C:\Users\maum\AppData\Local\Temp\cc553bQO.s:121760: Error: invalid register for .seh_savexmm
C:\Users\maum\AppData\Local\Temp\cc553bQO.s:186054: Error: invalid register for .seh_savexmm
C:\Users\maum\AppData\Local\Temp\cc553bQO.s:188560: Error: invalid register for .seh_savexmm
C:\Users\maum\AppData\Local\Temp\cc553bQO.
In addition: Warning message:
In system(cmd, intern = !verbose) :
running command 'C:/PROGRA~1/R/R-36~1.2/bin/x64/R CMD SHLIB file2828102563db.cpp 2> file2828102563db.cpp.err.txt' had status 1
Error in sink(type = "output") : invalid connection
Does this seem related?
To be precise this shows up when trying to compile the model with stan_model().
Things like that are usually due to having -mtune=native -march=native and the compiler misdiagnosing the processor. If you have that in CXX11FLAGS or something, try removing it.
Hi. Not sure whether it is acceptable to use this thread but I am experiencing issues compiling Stan models. I installed RStan without any issues.
Win 10, 64 bit, R 3.6.2, Rtools 3.5.0.4
However, when I try to run the following command:
example(stan_model, run.dontrun = TRUE)
I get the following errors:
g++.exe: error: Files/R/R-3.6.2/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp: No such file or directory
g++.exe: error: Files/R/R-3.6.2/library/StanHeaders/include: No such file or directory
g++.exe: error: Files/R/R-3.6.2/library/RcppEigen/include: No such file or directory
and the errors complain that
Files/R/R-3.6.2/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp
doesn’t exist, etc. The paths have been mangled.
Needless to say, these files and directories all exist on my machine.
Is there a way to force the paths to be properly quoted? And would that solve the problem?