Problems with crashing R session

Any suggestion @andrjohns? Do you have any idea what’s going on?

Is the problem with windows? And if I change the operating system it improves this problem.

Terribly sorry for the delay, I was away for a few days. I’m not entirely sure where the crashing is coming from, since your script doesn’t replicate the behaviour for me on either a Windows or a Linux machine and none of the usual culprits for these crashes are present.

Does the crash happen if you use the default settings? As in, just specifying the model and the data, not the number of iterations or inits, etc.

If it still crashes, there are two things I would try. First, you can try running your model through the cmdstanR package, which tends to be much more stable and also uses the latest release of Stan. Install instructions here: Getting started with CmdStanR • cmdstanr

Alternatively, you can try installing the experimental preview of the upcoming RStan 2.26. There may be some bugs, but that’s helpful for us to know about. To install, you need to restart your R session, and then run:

remove.packages(c("StanHeaders", "rstan"))
install.packages("StanHeaders", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
1 Like

FYI, I’ve been experiencing the same thing and have filed an issue on the RStudio GitHub:
Rstudio consistently-but-randomly slowing down & crashing when viewing Stan files

2 Likes

Cool Mike.
I took advantage and sent a message to RStudio too, suddenly we were able to solve this problem as quickly as possible.

1 Like

Hi, @andrjohns .
No problem about the delay.
I followed your suggestion and removed all indicated packages plus rstantools.
I will give you several details of the operation and you consider whether it is relevant or not ok.

remove.packages(c(“StanHeaders”, “rstan”,“rstantools”))

Upon restarting the session after removing them, the following message was displayed:

Warning: namespace ‘rstan’ is not available and has been replaced
by .GlobalEnv when processing object ‘.__C__C++Object’

And then I installed it again.

install.packages(“StanHeaders”, repos = c(“Repository for distributing (some) stan-dev R packages | r-packages”, getOption(“repos”)))
install.packages(“rstan”, repos = c(“Repository for distributing (some) stan-dev R packages | r-packages”, getOption(“repos”)))
install.packages(“rstantools”, repos = c(“Repository for distributing (some) stan-dev R packages | r-packages”, getOption(“repos”)))

So I made the rstan package available:

library(rstan)

  • with output:

Carregando pacotes exigidos: StanHeaders
rstan (Version 2.26.1, GitRev: 2e1f913d3ca3)
For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores()).
To avoid recompilation of unchanged Stan programs, we recommend calling
rstan_options(auto_write = TRUE)
For within-chain threading using reduce_sum() or map_rect() Stan functions,
change threads_per_chain option:
rstan_options(threads_per_chain = 1)

Do not specify ‘-march=native’ in ‘LOCAL_CPPFLAGS’ or a Makevars file

And now when specific, the model returns this to me:

model ← stan_model(model_name = “Morgan Mercer Flodin”, file = “Enviar forum/mod_MMF.stan”)

  • the output (white color):
    make cmd is
    make -f “C:/PROGRA~1/R/R-40~1.4/etc/x64/Makeconf” -f “C:/PROGRA~1/R/R-40~1.4/share/make/winshlib.mk” -f “D:/Users/Carlos Zarzar/Documents/.R/Makevars.win” CXX=’(CXX14) (CXX14STD)’ CXXFLAGS=’(CXX14FLAGS)' CXXPICFLAGS='(CXX14PICFLAGS)’ SHLIB_LDFLAGS=’(SHLIB_CXX14LDFLAGS)' SHLIB_LD='(SHLIB_CXX14LD)’ SHLIB=“file328c111c5a5c.dll” WIN=64 TCLBIN=64 OBJECTS=“file328c111c5a5c.o”

make would use
if test “zfile328c111c5a5c.o” != “z”; then
if test -e “file328c111c5a5c-win.def”; then
echo “C:/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file328c111c5a5c.dll file328c111c5a5c-win.def file328c111c5a5c.o “D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a” -L"D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/StanHeaders/libs/x64” -lStanHeaders -L"D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppParallel/lib/x64” -ltbb -LD:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppParallel/lib/x64 -ltbb -ltbbmalloc -L"C:/PROGRA~1/R/R-40~1.4/bin/x64" -lR ;
“C:/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file328c111c5a5c.dll file328c111c5a5c-win.def file328c111c5a5c.o “D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a” -L"D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/StanHeaders/libs/x64” -lStanHeaders -L"D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppParallel/lib/x64” -ltbb -LD:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppParallel/lib/x64 -ltbb -ltbbmalloc -L"C:/PROGRA~1/R/R-40~1.4/bin/x64" -lR ;
else
echo EXPORTS > tmp.def;
“C:/rtools40/mingw64/bin/“nm file328c111c5a5c.o | sed -n ‘s/^.* [BCDRT] / /p’ | sed -e ‘/[.]refptr[.]/d’ -e ‘/[.]weak[.]/d’ | sed 's/[^ ][^ ]*/”&”/g’ >> tmp.def;
echo “C:/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file328c111c5a5c.dll tmp.def file328c111c5a5c.o “D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a” -L"D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/StanHeaders/libs/x64” -lStanHeaders -L"D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppParallel/lib/x64” -ltbb -LD:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppParallel/lib/x64 -ltbb -ltbbmalloc -L"C:/PROGRA~1/R/R-40~1.4/bin/x64" -lR ;
“C:/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file328c111c5a5c.dll tmp.def file328c111c5a5c.o “D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a” -L"D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/StanHeaders/libs/x64” -lStanHeaders -L"D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppParallel/lib/x64” -ltbb -LD:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppParallel/lib/x64 -ltbb -ltbbmalloc -L"C:/PROGRA~1/R/R-40~1.4/bin/x64" -lR ;
rm -f tmp.def;
fi
fi

  • and the ouput erro (red color):
    Error in compileCode(f, code, language = language, verbose = verbose) :
    D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/ProductEvaluators.h:35:90: required from 'Eigen::internal::evaluator<Eigen::Product<Lhs, Rhs, Option> >::evaluator(const XprType&) [with Lhs = Eigen::Product<Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, Eigen::Matrix<double, -1, -1>, 0>; Rhs = Eigen::Matrix<double, -1, 1>; int Options = 0; Eigen::internal::evaluator<Eigen::Product<Lhs, Rhs, Option> >::XprType = Eigen::Product<Eigen::Product<Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, Eigen::Matrix<double, -1, -1>, 0>, Eigen::Matrix<double, -1, 1>, 0>]'D:/Us
    Além disso: Warning message:
    In readLines(file, warn = TRUE) :
    linha final incompleta encontrada em ‘D:\Users\Carlos Zarzar\Downloads\Stan_forum\Enviar forum\mod_MMF.stan’
    Error in sink(type = “output”) : conexão inválida

And so, now the .rds file is not generated

This looks like a possible culprit:

make would use

That should have a large block of code after it. This is all very strange.

Let’s double-check whether it will let you compile C++, can you post the output from the following:

Sys.which("make")
system("touch foo.cpp")
system("R CMD SHLIB foo.cpp")
1 Like

> Sys.which(“make”)

Sys.which(“make”)
make
“C:\rtools40\usr\bin\make.exe”

> system(“touch foo.cpp”)

system(“touch foo.cpp”)
[1] 0

> system(“R CMD SHLIB foo.cpp”)

"C:/rtools40/mingw64/bin/"g++ -std=gnu++11  -I"C:/PROGRA~1/R/R-40~1.4/include" -DNDEBUG   -I"D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/Rcpp/include/"  -I"D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/"  -I"D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/unsupported"  -I"D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/BH/include" -I"D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/StanHeaders/include/src/"  -I"D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/StanHeaders/include/"  -I"D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppParallel/include/"  -DRCPP_PARALLEL_USE_TBB=1 -I"D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/rstan/include" -DEIGEN_NO_DEBUG  -DBOOST_DISABLE_ASSERTS  -DBOOST_PENDING_INTEGER_LOG2_HPP  -DSTAN_THREADS  -DUSE_STANC3 -DSTRICT_R_HEADERS  -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION  -DBOOST_NO_AUTO_PTR  -include "D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/fun/Eigen.hpp"  -std=c++1y         -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c foo.cpp -o foo.o

In file included from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Core:397,
from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Dense:1,
from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/fun/Eigen.hpp:22,
from :
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:60:39: warning: ignoring attributes on template argument ‘__m128’ {aka ‘__vector(4) float’} [-Wignored-attributes]
template<> struct is_arithmetic<__m128> { enum { value = true }; };
^
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:61:40: warning: ignoring attributes on template argument ‘__m128i’ {aka ‘__vector(2) long long int’} [-Wignored-attributes]
template<> struct is_arithmetic<__m128i> { enum { value = true }; };
^
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:62:40: warning: ignoring attributes on template argument ‘__m128d’ {aka ‘__vector(2) double’} [-Wignored-attributes]
template<> struct is_arithmetic<__m128d> { enum { value = true }; };
^
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:161:43: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4f’ {aka ‘__vector(4) float’} [-Wignored-attributes]
template<> struct unpacket_traits { typedef float type; enum {size=4, alignment=Aligned16}; typedef Packet4f half; };
^
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:162:43: warning: ignoring attributes on template argument ‘Eigen::internal::Packet2d’ {aka ‘__vector(2) double’} [-Wignored-attributes]
template<> struct unpacket_traits { typedef double type; enum {size=2, alignment=Aligned16}; typedef Packet2d half; };
^
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:163:43: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4i’ {aka ‘__vector(2) long long int’} [-Wignored-attributes]
template<> struct unpacket_traits { typedef int type; enum {size=4, alignment=Aligned16}; typedef Packet4i half; };
^
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:718:35: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4f’ {aka ‘__vector(4) float’} [-Wignored-attributes]
struct palign_impl<Offset,Packet4f>
^
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:741:35: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4i’ {aka ‘__vector(2) long long int’} [-Wignored-attributes]
struct palign_impl<Offset,Packet4i>
^
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:764:35: warning: ignoring attributes on template argument ‘Eigen::internal::Packet2d’ {aka ‘__vector(2) double’} [-Wignored-attributes]
struct palign_impl<Offset,Packet2d>
^
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:778:34: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4f’ {aka ‘__vector(4) float’} [-Wignored-attributes]
ptranspose(PacketBlock<Packet4f,4>& kernel) {
^
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:783:34: warning: ignoring attributes on template argument ‘Eigen::internal::Packet2d’ {aka ‘__vector(2) double’} [-Wignored-attributes]
ptranspose(PacketBlock<Packet2d,2>& kernel) {
^
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:790:34: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4i’ {aka ‘__vector(2) long long int’} [-Wignored-attributes]
ptranspose(PacketBlock<Packet4i,4>& kernel) {
^
In file included from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Core:377,
from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Dense:1,
from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/fun/Eigen.hpp:22,
from :
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/Default/ConjHelper.h:15:70: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4f’ {aka ‘__vector(4) float’} [-Wignored-attributes]
template<> struct conj_helper<PACKET_REAL, PACKET_CPLX, false,false> {
^
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/SSE/Complex.h:232:1: note: in expansion of macro ‘EIGEN_MAKE_CONJ_HELPER_CPLX_REAL’
EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet2cf,Packet4f)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/Default/ConjHelper.h:22:70: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4f’ {aka ‘__vector(4) float’} [-Wignored-attributes]
template<> struct conj_helper<PACKET_CPLX, PACKET_REAL, false,false> {
^
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/SSE/Complex.h:232:1: note: in expansion of macro ‘EIGEN_MAKE_CONJ_HELPER_CPLX_REAL’
EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet2cf,Packet4f)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/Default/ConjHelper.h:15:70: warning: ignoring attributes on template argument ‘Eigen::internal::Packet2d’ {aka ‘__vector(2) double’} [-Wignored-attributes]
template<> struct conj_helper<PACKET_REAL, PACKET_CPLX, false,false> {
^
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/SSE/Complex.h:417:1: note: in expansion of macro ‘EIGEN_MAKE_CONJ_HELPER_CPLX_REAL’
EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet1cd,Packet2d)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/Default/ConjHelper.h:22:70: warning: ignoring attributes on template argument ‘Eigen::internal::Packet2d’ {aka ‘__vector(2) double’} [-Wignored-attributes]
template<> struct conj_helper<PACKET_CPLX, PACKET_REAL, false,false> {
^
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/SSE/Complex.h:417:1: note: in expansion of macro ‘EIGEN_MAKE_CONJ_HELPER_CPLX_REAL’
EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet1cd,Packet2d)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Core:370,
from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Dense:1,
from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/fun/Eigen.hpp:22,
from :
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/util/XprHelper.h: In instantiation of ‘struct Eigen::internal::find_best_packet<float, 4>’:
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/Matrix.h:22:57: required from ‘struct Eigen::internal::traits<Eigen::Matrix<float, 4, 1> >’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Geometry/Quaternion.h:242:7: required from ‘struct Eigen::internal::traits<Eigen::Quaternion >’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Geometry/arch/Geometry_SSE.h:24:46: required from here
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:187:44: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits::type’ {aka ‘__vector(4) float’} [-Wignored-attributes]
bool Stop = Size==Dynamic || (Size%unpacket_traits::size)==0 || is_same<PacketType,typename unpacket_traits::half>::value>
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:187:83: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits::type’ {aka ‘__vector(4) float’} [-Wignored-attributes]
bool Stop = Size==Dynamic || (Size%unpacket_traits::size)==0 || is_same<PacketType,typename unpacket_traits::half>::value>
~^~~~~
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:187:83: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits::type’ {aka ‘__vector(4) float’} [-Wignored-attributes]
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:187:83: warning: ignoring attributes on template argument ‘Eigen::internal::unpacket_traits<__vector(4) float>::half’ {aka ‘__vector(4) float’} [-Wignored-attributes]
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:205:88: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits::type’ {aka ‘__vector(4) float’} [-Wignored-attributes]
typedef typename find_best_packet_helper<Size,typename packet_traits::type>::type type;
^~~~
In file included from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Core:439,
from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Dense:1,
from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/fun/Eigen.hpp:22,
from :
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h: In instantiation of ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<float, 4, 1>, 0>’:
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:300:7: required from ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<float, 4, 1>, 1>’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:551:7: required from ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<float, 4, 1>, 3>’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/DenseBase.h:41:34: required from ‘class Eigen::DenseBase<Eigen::Matrix<float, 4, 1> >’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/MatrixBase.h:48:34: required from ‘class Eigen::MatrixBase<Eigen::Matrix<float, 4, 1> >’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/PlainObjectBase.h:98:7: required from ‘class Eigen::PlainObjectBase<Eigen::Matrix<float, 4, 1> >’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/Matrix.h:178:7: required from ‘class Eigen::Matrix<float, 4, 1>’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Geometry/Quaternion.h:46:50: required from ‘class Eigen::QuaternionBase<Eigen::Quaternion >’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Geometry/Quaternion.h:250:7: required from ‘class Eigen::Quaternion’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Geometry/arch/Geometry_SSE.h:27:3: required from here
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:55:30: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits::type’ {aka ‘__vector(4) float’} [-Wignored-attributes]
>::type PacketReturnType;
^~~~~~~~~~~~~~~~
In file included from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Core:370,
from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Dense:1,
from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/fun/Eigen.hpp:22,
from :
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/util/XprHelper.h: In instantiation of ‘struct Eigen::internal::find_best_packet<double, 4>’:
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/Matrix.h:22:57: required from ‘struct Eigen::internal::traits<Eigen::Matrix<double, 4, 1> >’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Geometry/Quaternion.h:242:7: required from ‘struct Eigen::internal::traits<Eigen::Quaternion >’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Geometry/arch/Geometry_SSE.h:88:47: required from here
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:187:44: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits::type’ {aka ‘__vector(2) double’} [-Wignored-attributes]
bool Stop = Size==Dynamic || (Size%unpacket_traits::size)==0 || is_same<PacketType,typename unpacket_traits::half>::value>
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:187:83: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits::type’ {aka ‘__vector(2) double’} [-Wignored-attributes]
bool Stop = Size==Dynamic || (Size%unpacket_traits::size)==0 || is_same<PacketType,typename unpacket_traits::half>::value>
~^~~~~
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:187:83: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits::type’ {aka ‘__vector(2) double’} [-Wignored-attributes]
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:187:83: warning: ignoring attributes on template argument ‘Eigen::internal::unpacket_traits<__vector(2) double>::half’ {aka ‘__vector(2) double’} [-Wignored-attributes]
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:205:88: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits::type’ {aka ‘__vector(2) double’} [-Wignored-attributes]
typedef typename find_best_packet_helper<Size,typename packet_traits::type>::type type;
^~~~
In file included from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Core:439,
from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Dense:1,
from D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/fun/Eigen.hpp:22,
from :
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h: In instantiation of ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1>, 0>’:
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:300:7: required from ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1>, 1>’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:551:7: required from ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1>, 3>’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/DenseBase.h:41:34: required from ‘class Eigen::DenseBase<Eigen::Matrix<double, 4, 1> >’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/MatrixBase.h:48:34: required from ‘class Eigen::MatrixBase<Eigen::Matrix<double, 4, 1> >’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/PlainObjectBase.h:98:7: required from ‘class Eigen::PlainObjectBase<Eigen::Matrix<double, 4, 1> >’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/Matrix.h:178:7: required from ‘class Eigen::Matrix<double, 4, 1>’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Geometry/Quaternion.h:46:50: required from ‘class Eigen::QuaternionBase<Eigen::Quaternion >’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Geometry/Quaternion.h:250:7: required from ‘class Eigen::Quaternion’
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Geometry/arch/Geometry_SSE.h:92:3: required from here
D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:55:30: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits::type’ {aka ‘__vector(2) double’} [-Wignored-attributes]
>::type PacketReturnType;
^~~~~~~~~~~~~~~~
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -shared -s -static-libgcc -o foo.dll tmp.def foo.o D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a -LD:/Users/Carlos Zarzar/Documents/R/win-library/4.0/StanHeaders/libs/x64 -lStanHeaders -LD:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppParallel/lib/x64 -ltbb -LD:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppParallel/lib/x64 -ltbb -ltbbmalloc -LC:/PROGRA~1/R/R-40~1.4/bin/x64 -lR
g++.exe: error: Zarzar/Documents/R/win-library/4.0/RcppParallel/lib/x64: No such file or directory
[1] 0

@hsbadr It looks like the linker path for the TBB isn’t in quotations, which is causing a compilation failure when there’s a space in the filepath. You can see the full command in the post above, which contains:

-LD:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppParallel/lib/x64 -ltbb 

Which results in the error:

g++.exe: error: Zarzar/Documents/R/win-library/4.0/RcppParallel/lib/x64: No such file or directory

LDFLAGS: Quote TBB library path · hsbadr/RcppParallel@5f730a3 · GitHub should fix this. Can you test it?

remove.packages("RcppParallel")
remotes::install_github("hsbadr/RcppParallel@develop", force = TRUE)
2 Likes

Thanks Hamada!

@Carlos_Zarzar Can you restart your R session, making sure that RStan doesn’t get loaded, then use the code above to update your RcppParallel package? Then try the rstan example model again

2 Likes

Ok, I did the recommended. And when it comes to running the example script in the declaration of the stan model [function stan_model ()] it came back to me:


stan_model(model_name = “Morgan Mercer Flodin”, file = “Enviar forum/mod_MMF.stan”)

Error in system.file(“lib”, .Platform$r_arch, package = “RcppParallel”, :
no file found
Furthermore: Warning message:
In read.dcf(file.path(p, “DESCRIPTION”), c(“Package”, “Version”)) :
could not open the compressed file ‘D:/Users/Carlos Zarzar/Documents/R/win-library/4.0/RcppParallel/DESCRIPTION’, probable reason ‘No such file or directory’
Error in sink(type = “output”) : invalid connection

It seems that RcppParallel hasn’t been installed successfuly. Do you have rtools installed? What’s the output of utils::packageVersion("RcppParallel")?

No, I don’t have rtools installed.

install.packages(“rtools”)

Installing package into ‘D:/Users/Carlos Zarzar/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘rtools’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

and about RcppParallel package it was also not installed.

utils::packageVersion(“RcppParallel”)
Error in utils::packageVersion(“RcppParallel”) :
there is no package called ‘RcppParallel’

What happens with the following command?

remotes::install_github("hsbadr/RcppParallel@develop", force = TRUE)

This should install the development version of RcppParallel, but it seems that it fails.


remotes::install_github(“hsbadr/RcppParallel@develop”, force = TRUE)

Erro: Failed to install ‘RcppParallel’ from GitHub:
(converted from notice) installation of package ‘C:/Users/CARLOS~1/AppData/Local/Temp/RtmpGezD8Y/file2d47738527d/RcppParallel_5.1.0-9000.tar.gz’ had non-zero exit status

This doesn’t explain the error (it should be printed before the message you shared), but it’s most likely missing git and/or make. So, try after installing Git for Windows from here and git2r R package:

install.packages("git2r")
1 Like

Ok, I installed Git from the website indicated and also installed the git2r package.
It seems to me that it was successfully installed.

Should I run the sample script to do the test?

Yes, but 1st make sure that you’ve RcppParallel v5.1.0.9000 installed:

utils::packageVersion("RcppParallel")
1 Like

Thank you so much @hsbadr
We partially solved the problem. I ran my stan model again [stan_model()], it is compiling and generating the .rds file, but it still persists in the main error described at the beginning of this topic, the Crashing Session RStudio.