# Error when running Rstan with update

**URL:** <https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792>\
**Category:** RStan\
**Created:** [March 21, 2020, 11:37pm UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792 "2020-03-21T23:37:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jades](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jades/32/14827_2.png) [@jades](https://discourse.mc-stan.org/u/jades)\
**Post date:** [March 21, 2020, 11:37pm UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/1 "2020-03-21T23:37:08Z")

</div>

Running on Mac, installed to Catalina  
R version 3.6.3  
R stan version: 2.19.3

```
Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! In file included from <built-in>:1:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppEigen/include/Eigen/Core:82:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/new:85:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/exception:82:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cstdlib:86:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/stdlib.h:94:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:66:
In file included from /Library/Developer
In addition: Warning message:
In system(cmd, intern = !verbose) :
  running command '/Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB file1247215182820.cpp 2> file1247215182820.cpp.err.txt' had status 1

```

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [March 22, 2020, 3:24am UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/2 "2020-03-22T03:24:25Z")

</div>

Can you do

```
library(rstan)
example(stan_model, run.dontrun = TRUE)

```

and tell us the line that has `error:` (with the colon) in it?

---

<div class="post-metadata">

**Author:** ![jades](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jades/32/14827_2.png) [@jades](https://discourse.mc-stan.org/u/jades)\
**Post date:** [March 22, 2020, 3:30am UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/3 "2020-03-22T03:30:46Z")

</div>

> [@bgoodri](#):
>
> library(rstan) example(stan\_model, run.dontrun = TRUE)

Yes, thanks.

Here it is

```no-highlight
/usr/local/include/stdint.h:7:10: fatal error: 'zzip/conf.h' file not found
#include <zzip/conf.h> 

```

That seems like an odd error, but when I cut and paste the output into text edit and search for “error:” that’s the only thing that comes up.

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [March 22, 2020, 3:34am UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/4 "2020-03-22T03:34:46Z")

</div>

Try doing

```
xcode-select --install

```

in the Terminal app or the Terminal window of RStudio.

---

<div class="post-metadata">

**Author:** ![jades](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jades/32/14827_2.png) [@jades](https://discourse.mc-stan.org/u/jades)\
**Post date:** [March 22, 2020, 3:35am UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/5 "2020-03-22T03:35:34Z")

</div>

> [@bgoodri](#):
>
> xcode-select --install

Yes, I tried that. I get:

```no-highlight
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

```

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [March 22, 2020, 3:36am UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/6 "2020-03-22T03:36:50Z")

</div>

All this is after having done

> [@Dealing with Catalina IV](https://discourse.mc-stan.org/t/dealing-with-catalina-iv/13502):
>
> If you are trying to install the pkg from in order to get the C++ toolchain setup on Catalina, then to open it you apparently have to hold down Ctrl while clicking on the installer file that you downloaded. At that point it should look like [[image] ](https://user-images.githubusercontent.com/833642/68826173-5f151400-0662-11ea-8a57-418f88f41ea3.png) and clicking Open will get it going. You probably need to have R 3.6 or later for things to work smoothly. Also, you will probably have to install rstan and related packages from source, via instal…

?

---

<div class="post-metadata">

**Author:** ![jades](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jades/32/14827_2.png) [@jades](https://discourse.mc-stan.org/u/jades)\
**Post date:** [March 22, 2020, 3:41am UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/7 "2020-03-22T03:41:22Z")

</div>

Okay…I recently downloaded Command\_Line\_Tools\_for\_Xcode\_11.4\_beta\_3, so as not to have the entire Xcode version. Would I just go back to that installer package and use control in the same way and then reinstall stan from source?

---

<div class="post-metadata">

**Author:** ![jades](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jades/32/14827_2.png) [@jades](https://discourse.mc-stan.org/u/jades)\
**Post date:** [March 22, 2020, 3:46am UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/8 "2020-03-22T03:46:18Z")

</div>

I found this link: [https://stackoverflow.com/questions/34617452/how-to-update-xcode-from-command-line](https://stackoverflow.com/questions/34617452/how-to-update-xcode-from-command-line).

It looks like

```
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

```

Does the trick.

---

<div class="post-metadata">

**Author:** ![jades](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jades/32/14827_2.png) [@jades](https://discourse.mc-stan.org/u/jades)\
**Post date:** [March 22, 2020, 4:20am UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/9 "2020-03-22T04:20:38Z")

</div>

Stan should be available for R 3.6.3 right? This is the output I get for install.packages(c(“StanHeaders”, “stan”), type = “source”).

```
Warning in install.packages :
  package ‘stan’ is not available (for R version 3.6.3)
trying URL 'https://cran.rstudio.com/src/contrib/StanHeaders_2.19.2.tar.gz'
Content type 'application/x-gzip' length 1278581 bytes (1.2 MB)
==================================================
downloaded 1.2 MB

* installing *source* package ‘StanHeaders’ ...
** package ‘StanHeaders’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -DNO_FPRINTF_OUTPUT -I"../inst/include" -include stan_sundials_printf_override.hpp -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c cvodes/cvodea.c -o cvodes/cvodea.o
In file included from cvodes/cvodea.c:29:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:66:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/wait.h:110:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/resource.h:72:
/usr/local/include/stdint.h:7:10: fatal error: 'zzip/conf.h' file not found
#include <zzip/conf.h> 
         ^ ~~~~~~~~~~~~
1 error generated.
make: *** [cvodes/cvodea.o] Error 1
ERROR: compilation failed for package ‘StanHeaders’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders’
Warning in install.packages :
  installation of package ‘StanHeaders’ had non-zero exit status

```

The downloaded source packages are in  
‘/private/var/folders/5v/66f0x8953rn0b13jmqw36qnm0000gn/T/RtmpfpUA37/downloaded\_packages’```

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [March 22, 2020, 4:31am UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/10 "2020-03-22T04:31:57Z")

</div>

You can probably get the binary for StanHeaders as long as you are not using Windows

```
install.packages("StanHeaders", type = "mac.binary")

```

But your `clang` is still messed up. It should be utilizing `/usr/local/clang7/` or something.

---

<div class="post-metadata">

**Author:** ![Jean\_Billie](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jean_billie/32/9186_2.png) [@Jean\_Billie](https://discourse.mc-stan.org/u/Jean_Billie)\
**Post date:** [March 22, 2020, 4:38am UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/11 "2020-03-22T04:38:30Z")

</div>

In my comupter, the latest Rstan works fine with the latest R on Win10.

I also encountered some error about a week ago. Then, I threw away all files related R, and reinstalled them. Then Rstan works fine :)

---

<div class="post-metadata">

**Author:** ![jades](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jades/32/14827_2.png) [@jades](https://discourse.mc-stan.org/u/jades)\
**Post date:** [March 22, 2020, 4:42am UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/12 "2020-03-22T04:42:03Z")

</div>

Sorry–do you mean you just deleted everything?

---

<div class="post-metadata">

**Author:** ![Jean\_Billie](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jean_billie/32/9186_2.png) [@Jean\_Billie](https://discourse.mc-stan.org/u/Jean_Billie)\
**Post date:** [March 22, 2020, 4:46am UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/13 "2020-03-22T04:46:53Z")

</div>

Yes!  
I removed everything, including installed packages  
I am beginner. If you took a lot of time for them,…please try.

---

<div class="post-metadata">

**Author:** ![jades](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jades/32/14827_2.png) [@jades](https://discourse.mc-stan.org/u/jades)\
**Post date:** [March 22, 2020, 4:51am UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/14 "2020-03-22T04:51:28Z")

</div>

Haha…thanks. Yeah, there are a ton of packages. I’ll probably wait for some others to weigh in. But if you’re already on Stan, you’re moving quick, so kudos to you.

When I run the

```
install.packages("StanHeaders", type = "mac.binary")

```

I receive the following error:

```
> install.packages("StanHeaders", type = "mac.binary")
Error in install.packages : Updating loaded packages
> install.packages("StanHeaders", type = "mac.binary")
Warning in install.packages :
  unable to access index for repository https://cran.rstudio.com/bin/macosx/contrib/3.6:
  cannot open URL 'https://cran.rstudio.com/bin/macosx/contrib/3.6/PACKAGES'

   package ‘StanHeaders’ is available as a source package but not as a binary

Warning in install.packages :
  package ‘StanHeaders’ is not available (as a binary package for R version 3.6.3)

```

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [March 22, 2020, 5:03am UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/15 "2020-03-22T05:03:39Z")

</div>

OK. Try

```
install.packages(
"https://cran.r-project.org/bin/macosx/el-capitan/contrib/3.6/StanHeaders_2.21.0-1.tgz",
repos = NULL, type = "mac.binary")

```

---

<div class="post-metadata">

**Author:** ![jades](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jades/32/14827_2.png) [@jades](https://discourse.mc-stan.org/u/jades)\
**Post date:** [March 22, 2020, 10:08pm UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/16 "2020-03-22T22:08:52Z")

</div>

Awesome, so that downloaded it.

However, it’s still not running:  
when I run the

```
example(stan_model, run.dontrun = TRUE)

```

I still get the same error as above:

```
/usr/local/include/stdint.h:7:10: fatal error: 'zzip/conf.h' file not found
#include <zzip/conf.h> 

```

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [March 22, 2020, 10:16pm UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/17 "2020-03-22T22:16:58Z")

</div>

Try adding

```
CXX14 = /usr/local/clang7/bin/clang++ -stdlib=libc++ -nostdinc++ -I/usr/local/clang7/include/c++/v1

```

to the bottom of ~/.R/Makevars .

---

<div class="post-metadata">

**Author:** ![jades](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jades/32/14827_2.png) [@jades](https://discourse.mc-stan.org/u/jades)\
**Post date:** [March 22, 2020, 11:01pm UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/18 "2020-03-22T23:01:37Z")

</div>

> [@bgoodri](#):
>
> ```no-highlight
> CXX14 = /usr/local/clang7/bin/clang++ -stdlib=libc++ -nostdinc++ -I/usr/local/clang7/include/c++/v1
> 
> ```

Hmmm–so I didn’t have that file, but I created it the text file within the .R directory and added the code. Still not working, but there isn’t any “Error:”

The error I do get is

```no-highlight
Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! /bin/sh: /usr/local/clang7/bin/clang++: No such file or directory
make: *** [file39641b876b73.o] Error 127

```

I’ll do a search for this on the internet as well.

I continually get this pop-up as well.  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/mc_stan/original/2X/7/74ae8cdac3fb491e9d56ae596f40b59351069bd9.png)

Thanks!

---

<div class="post-metadata">

**Author:** ![jades](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jades/32/14827_2.png) [@jades](https://discourse.mc-stan.org/u/jades)\
**Post date:** [March 22, 2020, 11:20pm UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/19 "2020-03-22T23:20:42Z")

</div>

I’m looking at this thread: [Error in compileCode(f, code, language = language, verbose = verbose) : Compilation ERROR, function(s)/method(s) not created!](https://discourse.mc-stan.org/t/error-in-compilecode-f-code-language-language-verbose-verbose-compilation-error-function-s-method-s-not-created/12607/20).

I tried installing stan from source: however, I get this error:

```
/bin/sh: /usr/local/clang7/bin/clang++: No such file or directory
make: *** [chains.o] Error 127
ERROR: compilation failed for package ‘rstan’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rstan’
Warning in install.packages :
  installation of package ‘rstan’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/5v/66f0x8953rn0b13jmqw36qnm0000gn/T/RtmpFtKGAw/downloaded_packages’

```

Should I alter the code within the Makevars folder?

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [March 23, 2020, 1:16am UTC](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792/20 "2020-03-23T01:16:25Z")

</div>

What version of clang is in `/usr/local`?

[Next page](https://discourse.mc-stan.org/t/error-when-running-rstan-with-update/13792.md?page=2)
