前提・実現したいこと
rstanのインストールの後、Getting Startedにあったコードを実行してみたところ、
エラーが発生しました。
せっかくrstanをインストールしたのに、フィッティング以降の処理を実行できず、全く使えないものになってしまい困っています。
使用したコードとデータは、RStan Getting Startedに書かれている例「Eight Schools」のものです。
発生している問題・エラーメッセージ
Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'C:/Users/UserName/AppData/Local/Temp/RtmpMFr9rJ/file11b4779f3703.dll': LoadLibrary failure: ダイナミック リンク ライブラリ (DLL) 初期化ルーチンの実行に失敗しました。 In addition: Warning message: In readLines(file, warn = TRUE) : incomplete final line found on (使用したstanファイルのパス) Error in sink(type = "output") : invalid connection
該当のソースコード
R
1fit <- stan(file = '8schools.stan', data = schools_dat)
試したこと
関係あるかはわかりませんが、
rstanのインストール前に、以下のコードを実行して、「TRUE」になりました。
R
1pkgbuild::has_build_tools(debug = TRUE)
追記(2019/06/23 8:40)
g++とC++の動作確認のコードを実行しました。どちらも成功しました。
g++のチェック(最後にgccのバージョンが表示されたら成功)
R
1> system('g++ -v')
結果
R
1Using built-in specs. 2COLLECT_GCC=C:\TDM-GC~1\bin\G__~1.EXE 3COLLECT_LTO_WRAPPER=C:/TDM-GC~1/bin/../libexec/gcc/x86_64-w64-mingw32/5.1.0/lto-wrapper.exe 4Target: x86_64-w64-mingw32 5Configured with: ../../../src/gcc-5.1.0/configure --build=x86_64-w64-mingw32 --enable-targets=all --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-libgomp --enable-lto --enable-graphite --enable-cxx-flags=-DWINPTHREAD_STATIC --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-libstdcxx-debug --enable-threads=posix --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libstdcxx-threads --enable-libstdcxx-time --with-gnu-ld --disable-werror --disable-nls --disable-win32-registry --prefix=/mingw64tdm --with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=http://tdm-gcc.tdragon.net/bugs 6Thread model: posix 7gcc version 5.1.0 (tdm64-1) 8[1] 0
c++の動作確認
R
1> fx <- inline::cxxfunction( signature(x = "integer", y = "numeric" ) , 'return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ; ') 2> fx( 2L, 5 )
結果
R
1bash.exe: warning: could not find /tmp, please create! 2bash.exe: warning: could not find /tmp, please create! 3/Rtools/bin/sed: -e expression #1, char 1: unknown command: `C' 4/Rtools/bin/sed: couldn't flush stdout: Invalid or incomplete multibyte or wide character
R
1[1] 10
補足情報(FW/ツールのバージョンなど)
実行環境
Windows 10 Home
R version 3.6.0
RStudio version 1.1.456
rstan 2.18.2
Rtools35
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/06/22 23:53