Rstan with weird error code on Windows, please help !

1,090 views
Skip to first unread message

huiying

unread,
Jul 4, 2016, 6:12:36 AM7/4/16
to Stan users mailing list
Hi all,

My code was running perfectly fine, until last week it started to give me really long error code that I couldn't understand.

I have copied and paste the error code in docx, and attached it here.

I have tried uninstalled and re-installed R, Rstudio, Rtools and the rstan packages, but still could not fixed it.

The same code could run on my Mac but I need it to run on my Windows desktop as well.

I may have accidentally removed something, I'm not sure what is that.

I'll truly appreciate if anyone is willing to take a look at my error code and enlighten me.

Thanks very much.

Best regards,
Huiying
Error code.docx

Ben Goodrich

unread,
Jul 4, 2016, 10:00:57 AM7/4/16
to Stan users mailing list
On Monday, July 4, 2016 at 6:12:36 AM UTC-4, huiying wrote:
My code was running perfectly fine, until last week it started to give me really long error code that I couldn't understand.

The actual error is

g++.exe: error: Chua/Documents/R/win-library/3.3/StanHeaders/libs/x64: No such file or directory

which I believe means that either you are not using RTools33 or maybe that StanHeaders was installed before RTools33 was installed.

Ben

huiying

unread,
Jul 5, 2016, 12:17:32 AM7/5/16
to Stan users mailing list
Hi Ben,

Thanks so much for responding !

I think I installed Rtools33 with corresponding R version 3.3.1.

The error code still exists after I installed an older version of R 3.2.5 and Rtools32.

I think my path is correct, based on the below:

> Sys.getenv('PATH')
[1] "C:\\Program Files\\R\\R-3.2.5\\bin\\x64;c:\\Rtools\\bin;c:\\Rtools\\gcc-4.6.3\\bin;C:\\Program Files\\ImageMagick-7.0.2-Q16;c:\\Rtools\\bin;c:\\Rtools\\gcc-4.6.3\\bin;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Git\\cmd"

> system('g++ -v')
Using built-in specs.
COLLECT_GCC=c:\Rtools\GCC-46~1.3\bin\G__~1.EXE
COLLECT_LTO_WRAPPER=c:/rtools/gcc-46~1.3/bin/../libexec/gcc/i686-w64-mingw32/4.6.3/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: /data/gannet/ripley/Sources/mingw-test3/src/gcc/configure --host=i686-w64-mingw32 --build=x86_64-linux-gnu --target=i686-w64-mingw32 --with-sysroot=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/mingw32 --prefix=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/mingw32 --with-gmp=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/prereq_install --with-mpfr=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/prereq_install --with-mpc=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/prereq_install --disable-shared --enable-static --enable-targets=all --enable-languages=c,c++,fortran --enable-libgomp --enable-sjlj-exceptions --enable-fully-dynamic-string --disable-nls --disable-werror --enable-checking=release --disable-win32-registry --disable-rpath --disable-werror CFLAGS='-O2 -mtune=core2 -fomit-frame-pointer' LDFLAGS=
Thread model: win32
gcc version 4.6.3 20111208 (prerelease) (GCC) 

> system('where make')
c:\Rtools\bin\make.exe

I'm not sure if I understand what you said that StanHeaders was installed before Rtools. Isn't StanHeaders installed along with rstan when we specify dependencies = TRUE? Anyway, if that is the source of error, what should I do? remove.packages(StanHeaders) doesn't help.

Huiying

Ben Goodrich

unread,
Jul 5, 2016, 12:46:46 AM7/5/16
to Stan users mailing list
On Tuesday, July 5, 2016 at 12:17:32 AM UTC-4, huiying wrote:
I'm not sure if I understand what you said that StanHeaders was installed before Rtools. Isn't StanHeaders installed along with rstan when we specify dependencies = TRUE? Anyway, if that is the source of error, what should I do? remove.packages(StanHeaders) doesn't help.

You need to have StanHeaders installed. What is the output of

dir(system.file("libs", package = "StanHeaders"), recursive = TRUE)

Ben

huiying

unread,
Jul 5, 2016, 1:52:56 AM7/5/16
to Stan users mailing list
Hi Ben,

The output of that is 

dir(system.file("libs", package = "StanHeaders"), recursive = TRUE)
[1] "i386/StanHeaders.dll" "i386/symbols.rds"     "x64/StanHeaders.dll"  "x64/symbols.rds"  


Huiying

Ben Goodrich

unread,
Jul 5, 2016, 2:23:34 AM7/5/16
to Stan users mailing list
On Tuesday, July 5, 2016 at 1:52:56 AM UTC-4, huiying wrote:
Hi Ben,

The output of that is 

dir(system.file("libs", package = "StanHeaders"), recursive = TRUE)
[1] "i386/StanHeaders.dll" "i386/symbols.rds"     "x64/StanHeaders.dll"  "x64/symbols.rds"  

That looks correct. But then I cannot explain why you would have an error that says


g++.exe: error: Chua/Documents/R/win-library/3.3/StanHeaders/libs/x64: No such file or directory

since StanHeaders/libs/x64 is clearly there. Do you have multiple directories where packages are installed?

Ben
 

huiying

unread,
Jul 5, 2016, 2:27:55 AM7/5/16
to Stan users mailing list
I'm not sure how I tell that, but I have two program files in my local disk C:, A folder named "Program Files" and the other named "Program Files (x86)". Could that be the reason?

Huiying

Ben Goodrich

unread,
Jul 5, 2016, 2:29:58 AM7/5/16
to Stan users mailing list

Upon further review, I think the problem is the space in the directory name between huiying and Chua. We can fix that, although for the time being it may be better to install packages to a directory without spaces.

Ben


Ben Goodrich

unread,
Jul 5, 2016, 2:54:34 AM7/5/16
to Stan users mailing list
On Tuesday, July 5, 2016 at 2:29:58 AM UTC-4, Ben Goodrich wrote:
Upon further review, I think the problem is the space in the directory name between huiying and Chua. We can fix that, although for the time being it may be better to install packages to a directory without spaces.

Try installing rstan from GitHub

devtools::install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan", build_vignettes = TRUE, dependencies = TRUE)

Ben

huiying

unread,
Jul 5, 2016, 3:05:42 AM7/5/16
to Stan users mailing list
I don't think the space could be problem because i have been running rstan successfully on the same desktop for a few months.

The command line gave me this:

> devtools::install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan", build_vignettes = TRUE, dependencies = TRUE)
Downloading GitHub repo stan-dev/rstan@develop
Error in utils::unzip(src, exdir = target) : 
  cannot open file 'C:/Users/HUIYIN~1/AppData/Local/Temp/RtmpAvzGhT/devtools16641de2372c/stan-dev-rstan-cc141a5/rstan/rstan/R/AllClass.R': No such file or directory
In addition: Warning message:
GitHub repo contains submodules, may not function as expected! 


I think it doesn't work? but install.packages("rstan", dependencies = TRUE) gave no problem.


> install.packages("rstan", dependencies = TRUE)
Installing package into ‘C:/Users/huiying Chua/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Content type 'application/zip' length 3344445 bytes (3.2 MB)
downloaded 3.2 MB

package ‘rstan’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\huiying Chua\AppData\Local\Temp\RtmpmIPMcR\downloaded_packages



Huiying

huiying

unread,
Jul 5, 2016, 6:30:06 AM7/5/16
to Stan users mailing list
Hi Ben,

I'm sorry, I think you may be right that it has something to do with my Windows account username. Thanks so much for your insights.

I created a new username without a space and managed to run stan. Yay! but it gives me a couple of weird lines before sampling starts.

> model.fit <- iter.func(ss = 2000, sim = 100)
DIAGNOSTIC(S) FROM PARSER:
Warning (non-fatal): assignment operator <- deprecated in the Stan language; use = instead.

C:/Users/hychua/Documents/R/win-library/3.2/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:14:17: warning: 'void stan::math::set_zero_all_adjoints()' defined but not used [-Wunused-function]

SAMPLING FOR MODEL '2016_06_14_tnd_misclass' NOW (CHAIN 1).

Chain 1, Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 1, Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 1, Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 1, Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 1, Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 1, Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 1, Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 1, Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 1, Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 1, Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 1, Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 1, Iteration: 2000 / 2000 [100%]  (Sampling)
 Elapsed Time: 6.986 seconds (Warm-up)
               6.443 seconds (Sampling)
               13.429 seconds (Total)


CHECKING DATA AND PREPROCESSING FOR MODEL '2016_06_14_tnd_misclass' NOW.
.....

Glad to finally see the command running again, but the error lines which has never occurred to me running the same script can be annoying.

Wonder if the rstan package is being upgraded and become compatible with something on the desktop? I don't know.

Huiying

Ben Goodrich

unread,
Jul 5, 2016, 9:12:03 AM7/5/16
to Stan users mailing list
On Tuesday, July 5, 2016 at 3:05:42 AM UTC-4, huiying wrote:
I don't think the space could be problem because i have been running rstan successfully on the same desktop for a few months.

Prior to 2.10.1, we did not have to link to a shared object in the StanHeaders package, so this issue with the space in the directory name did not come up (or rather it came up with Rcpp but Mav anticipated it and I managed to not anticipate it for StanHeaders).
 
The command line gave me this:

> devtools::install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan", build_vignettes = TRUE, dependencies = TRUE)
Downloading GitHub repo stan-dev/rstan@develop
Error in utils::unzip(src, exdir = target) : 
  cannot open file 'C:/Users/HUIYIN~1/AppData/Local/Temp/RtmpAvzGhT/devtools16641de2372c/stan-dev-rstan-cc141a5/rstan/rstan/R/AllClass.R': No such file or directory
In addition: Warning message:
GitHub repo contains submodules, may not function as expected! 


I think it doesn't work? but install.packages("rstan", dependencies = TRUE) gave no problem.

That wasn't supposed to happen. Let me try on Windows later.

Ben

Dan Dalthorp

unread,
Jul 5, 2016, 11:52:07 AM7/5/16
to stan-...@googlegroups.com
I am using Rtools33 with R 3.3.1 and had (roughly) the same error that Huiying had:
g++.exe: error: Files/R/R-3.3.1/library/StanHeaders/libs/x64: No such file or directory

And, like g++.exe, I couldn't find that directory either. But I can find: 
c:/Program Files/R/R-3.3.1/library/StanHeaders/libs/x64

Is g++.exe having trouble understanding the " " in Windows path names?

-Dan

--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
To post to this group, send email to stan-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ben Goodrich

unread,
Jul 5, 2016, 2:50:08 PM7/5/16
to Stan users mailing list
On Tuesday, July 5, 2016 at 11:52:07 AM UTC-4, Dan D wrote:
I am using Rtools33 with R 3.3.1 and had (roughly) the same error that Huiying had:
g++.exe: error: Files/R/R-3.3.1/library/StanHeaders/libs/x64: No such file or directory

And, like g++.exe, I couldn't find that directory either. But I can find: 
c:/Program Files/R/R-3.3.1/library/StanHeaders/libs/x64

Is g++.exe having trouble understanding the " " in Windows path names?

Yes. Does

devtools::install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan", build_vignettes = TRUE, dependencies = TRUE)

fix it for you?

Ben


Dan Dalthorp

unread,
Jul 5, 2016, 3:08:32 PM7/5/16
to stan-...@googlegroups.com
Error in loadNamespace(name) : there is no package called ‘curl’

Ben Goodrich

unread,
Jul 5, 2016, 3:23:37 PM7/5/16
to Stan users mailing list
On Tuesday, July 5, 2016 at 3:08:32 PM UTC-4, Dan D wrote:
Error in loadNamespace(name) : there is no package called ‘curl’

Do

install.packages("curl")

first.

Ben

Dan Dalthorp

unread,
Jul 5, 2016, 5:11:01 PM7/5/16
to stan-...@googlegroups.com
Almost...

This worked (thanks!):
> devtools::install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan", build_vignettes = FALSE, dependencies = TRUE)

But this didn't:
> devtools::install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan", build_vignettes = FALSE, dependencies = TRUE)

# Error: processing vignette 'rstan.Rmd' failed with diagnostics:
# It seems you should call rmarkdown::render() instead of knitr::knit2html() because rstan.Rmd appears to be an R Markdown v2 document.

Also, I got several notes that I'd be inclined to ignore for now if it were just me who'd need my stuff, but I'm in the final stages of publishing a package that uses an rstan model for some of the calculations. I need users with who-knows-what computer configurations to be able to use it. Are the following a problem?

#pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated
#pragma message: NOTE: Use of this header (bool_trait_def.hpp) is deprecated

-Dan

Dan Dalthorp

unread,
Jul 5, 2016, 5:12:02 PM7/5/16
to stan-...@googlegroups.com
ERRATUM:
The command that didn't work is:
> devtools::install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan", build_vignettes = TRUE, dependencies = TRUE)

Ben Goodrich

unread,
Jul 5, 2016, 7:53:00 PM7/5/16
to Stan users mailing list
On Tuesday, July 5, 2016 at 5:11:01 PM UTC-4, Dan D wrote:
#pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated
#pragma message: NOTE: Use of this header (bool_trait_def.hpp) is deprecated

Those don't matter and they might not even appear with the next version of BH. You may need pandoc and whatnot to build the vignettes, but if you can't, then you can always read them from

https://cran.r-project.org/web/packages/rstan/index.html

Ben

huiying

unread,
Jul 5, 2016, 10:55:36 PM7/5/16
to Stan users mailing list
Hi Ben,

I'm not completely sure if Dan's problem and mine are the same, except that this command doesn't work for us

devtools::install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan", build_vignettes = TRUE, dependencies = TRUE)

The above command gave the same error as before, after setting path name to one without a space.

Did you manage to try on Windows?

Huiying

Natesh Pillai

unread,
Jul 7, 2016, 11:09:20 AM7/7/16
to Stan users mailing list
I installed curl and then re ran 

> devtools::install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan", build_vignettes = FALSE, dependencies = TRUE)


I got this:
Error in curl::curl_fetch_disk(url, x$path, handle = handle) : 
  Timeout was reached

Please help
Natesh

Ben Goodrich

unread,
Jul 7, 2016, 11:28:10 AM7/7/16
to Stan users mailing list

Maybe GitHub is experiencing network issues or maybe you have some firewall or something blocking downloads?

Natesh Pillai

unread,
Jul 7, 2016, 12:34:29 PM7/7/16
to Stan users mailing list
I asked my sysadmit, and he couldn't tell. 
Can I directly download manually whatever I need to my computer, so that I can install rstan? If so, what url should I download it from 
and where should I save it my computer? How do I ensure that all the dependencies are also in the same place?
thanks so much for the help.

Ben Goodrich

unread,
Jul 7, 2016, 4:10:32 PM7/7/16
to Stan users mailing list
On Thursday, July 7, 2016 at 12:34:29 PM UTC-4, Natesh Pillai wrote:
I asked my sysadmit, and he couldn't tell. 
Can I directly download manually whatever I need to my computer, so that I can install rstan? If so, what url should I download it from 
and where should I save it my computer? How do I ensure that all the dependencies are also in the same place?
thanks so much for the help.

It may work if you just do


with the existing installation.

Ben
 

Julian King

unread,
Jul 20, 2016, 5:46:14 AM7/20/16
to Stan users mailing list
I can confirm the issue with the space in the name - I can't avoid it due to enterprise policies on the computer.

I have tried the devtools fix but get this:


> install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan", build_vignettes = TRUE, dependencies = TRUE)
Downloading GitHub repo stan-dev/rstan@develop
from URL https://api.github.com/repos/stan-dev/rstan/zipball/develop
Error: running command '"C:/PROGRA~1/R/R-33~1.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD config CC' had status 2

In addition: Warning message:
GitHub repo contains submodules, may not function as expected!
 



Ben Goodrich

unread,
Jul 20, 2016, 9:59:42 AM7/20/16
to Stan users mailing list
On Wednesday, July 20, 2016 at 5:46:14 AM UTC-4, Julian King wrote:
I can confirm the issue with the space in the name - I can't avoid it due to enterprise policies on the computer.

For at least the next few hours, you can do

install.packages("http://win-builder.r-project.org/Z1N0He79FT3r/rstan_2.10.1-1.zip",
                 
repos = NULL, dependencies = TRUE)

Ben
 

Julian King

unread,
Jul 21, 2016, 6:39:04 AM7/21/16
to Stan users mailing list
Thanks Ben - this worked!

Julian

Canh DO

unread,
Jul 28, 2016, 8:37:59 AM7/28/16
to Stan users mailing list
I encountered the same error. After trying to fix this error in a few hours, I found that this error comes from the space symbol (' ') in the directory path of R package library. Then I changed it to another folder without the space symbol and this error disappeared.
Reply all
Reply to author
Forward
0 new messages