Compilation errors installing PyStan+CVODES on Arch Linux

I’m installing PyStan on an Arch Linux computer. Installing the default package with pip works great. However, I expect to do pretty much nothing except fit ODE models with Stan, so I’d like to install the SUNDIAL-enabled version.

When I try, I get a huge mess of errors like the ones below (the full list is longer than my terminal’s buffer). I’ve tried installing using the link recommended on https://pystan.readthedocs.io/en/latest/installation_cvodes.html and by cloning the cvodes branch from the Github repo and installing with either pip or setup.py (same result with each, more or less).

It looks like maybe some part of the compilation process thinks I’m on Windows? There’s an error in there about not being able to read the registry to find a C compiler, if I’m reading it right… any ideas?

creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/pystan
creating build/temp.linux-x86_64-3.8/pystan/stan
creating build/temp.linux-x86_64-3.8/pystan/stan/src
creating build/temp.linux-x86_64-3.8/pystan/stan/src/stan
creating build/temp.linux-x86_64-3.8/pystan/stan/src/stan/lang
creating build/temp.linux-x86_64-3.8/pystan/stan/src/stan/lang/grammars
compile options: '-DBOOST_DISABLE_ASSERTS -DBOOST_NO_DECLTYPE -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -DBOOST_RESULT_OF_USE_TR1 -DFUSION_MAX_VECTOR_SIZE=12 -I./pystan -Ipystan/stan/src -Ipystan/stan/lib/stan_math/ -Ipystan/stan/lib/stan_math/lib/eigen_3.3.3 -Ipystan/stan/lib/stan_math/lib/boost_1.69.0 -Ipystan/stan/lib/stan_math/lib/sundials_4.1.0/include -I/usr/include/python3.8 -c'
extra options: '-Os -ftemplate-depth-256 -Wno-unused-function -Wno-uninitialized -std=c++1y'
gcc: pystan/_api.cpp
gcc: pystan/stan/src/stan/lang/grammars/bare_type_grammar_inst.cpp
gcc: pystan/stan/src/stan/lang/grammars/expression_grammar_inst.cpp
gcc: pystan/stan/src/stan/lang/grammars/block_var_decls_grammar_inst.cpp
gcc: pystan/stan/src/stan/lang/ast_def.cpp
gcc: pystan/stan/src/stan/lang/grammars/expression07_grammar_inst.cpp
gcc: pystan/stan/src/stan/lang/grammars/indexes_grammar_inst.cpp
gcc: pystan/stan/src/stan/lang/grammars/functions_grammar_inst.cpp
gcc: pystan/stan/src/stan/lang/grammars/local_var_decls_grammar_inst.cpp
In file included from pystan/stan/src/stan/lang/generator/expression_visgen.hpp:7,
                 from pystan/stan/src/stan/lang/generator/generate_expression.hpp:5,
                 from pystan/stan/src/stan/lang/generator/write_begin_all_dims_col_maj_loop.hpp:6,
                 from pystan/stan/src/stan/lang/generator.hpp:10,
                 from pystan/stan/src/stan/lang/compiler.hpp:6,
                 from pystan/stanc.hpp:2,
                 from pystan/_api.cpp:686:
pystan/stan/src/stan/lang/generator/generate_indexed_expr.hpp: In instantiation of ‘void stan::lang::generate_indexed_expr(const string&, const std::vector<stan::lang::expression>&, stan::lang::bare_expr_type, bool, std::ostream&) [with bool isLHS = false; std::string = std::__cxx11::basic_string<char>; std::ostream = std::basic_ostream<char>]’:
pystan/stan/src/stan/lang/generator/expression_visgen.hpp:106:50:   required from here
pystan/stan/src/stan/lang/generator/generate_indexed_expr.hpp:44:31: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<stan::lang::expression>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   44 |       && base_type.num_dims() == indexes.size()) {
      |          ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
gcc: pystan/stan/src/stan/lang/grammars/program_grammar_inst.cpp
gcc: pystan/stan/src/stan/lang/grammars/semantic_actions_def.cpp
gcc: pystan/stan/src/stan/lang/grammars/statement_2_grammar_inst.cpp
gcc: pystan/stan/src/stan/lang/grammars/statement_grammar_inst.cpp
gcc: pystan/stan/src/stan/lang/grammars/term_grammar_inst.cpp
gcc: pystan/stan/src/stan/lang/grammars/whitespace_grammar_inst.cpp
g++ -pthread -shared -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fno-semantic-interposition -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now build/temp.linux-x86_64-3.8/pystan/_api.o build/temp.linux-x86_64-3.8/pystan/stan/src/stan/lang/ast_def.o build/temp.linux-x86_64-3.8/pystan/stan/src/stan/lang/grammars/bare_type_grammar_inst.o build/temp.linux-x86_64-3.8/pystan/stan/src/stan/lang/grammars/block_var_decls_grammar_inst.o build/temp.linux-x86_64-3.8/pystan/stan/src/stan/lang/grammars/expression07_grammar_inst.o build/temp.linux-x86_64-3.8/pystan/stan/src/stan/lang/grammars/expression_grammar_inst.o build/temp.linux-x86_64-3.8/pystan/stan/src/stan/lang/grammars/functions_grammar_inst.o build/temp.linux-x86_64-3.8/pystan/stan/src/stan/lang/grammars/indexes_grammar_inst.o build/temp.linux-x86_64-3.8/pystan/stan/src/stan/lang/grammars/local_var_decls_grammar_inst.o build/temp.linux-x86_64-3.8/pystan/stan/src/stan/lang/grammars/program_grammar_inst.o build/temp.linux-x86_64-3.8/pystan/stan/src/stan/lang/grammars/semantic_actions_def.o build/temp.linux-x86_64-3.8/pystan/stan/src/stan/lang/grammars/statement_2_grammar_inst.o build/temp.linux-x86_64-3.8/pystan/stan/src/stan/lang/grammars/statement_grammar_inst.o build/temp.linux-x86_64-3.8/pystan/stan/src/stan/lang/grammars/term_grammar_inst.o build/temp.linux-x86_64-3.8/pystan/stan/src/stan/lang/grammars/whitespace_grammar_inst.o -L/usr/lib -o build/lib.linux-x86_64-3.8/pystan/_api.cpython-38-x86_64-linux-gnu.so
building 'pystan._chains' extension
C compiler: gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fno-semantic-interposition -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC

compile options: '-DBOOST_DISABLE_ASSERTS -DBOOST_NO_DECLTYPE -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -DBOOST_RESULT_OF_USE_TR1 -DFUSION_MAX_VECTOR_SIZE=12 -Ipystan/stan/src -Ipystan/stan/lib/stan_math/ -Ipystan/stan/lib/stan_math/lib/eigen_3.3.3 -Ipystan/stan/lib/stan_math/lib/boost_1.69.0 -Ipystan/stan/lib/stan_math/lib/sundials_4.1.0/include -I/usr/include/python3.8 -c'
extra options: '-Os -ftemplate-depth-256 -Wno-unused-function -Wno-uninitialized -std=c++1y'
gcc: pystan/_chains.cpp
pystan/_chains.cpp:668:10: fatal error: stan/math/prim/mat/fun/autocovariance.hpp: No such file or directory
  668 | #include "stan/math/prim/mat/fun/autocovariance.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: Command "gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fno-semantic-interposition -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC -DBOOST_DISABLE_ASSERTS -DBOOST_NO_DECLTYPE -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -DBOOST_RESULT_OF_USE_TR1 -DFUSION_MAX_VECTOR_SIZE=12 -Ipystan/stan/src -Ipystan/stan/lib/stan_math/ -Ipystan/stan/lib/stan_math/lib/eigen_3.3.3 -Ipystan/stan/lib/stan_math/lib/boost_1.69.0 -Ipystan/stan/lib/stan_math/lib/sundials_4.1.0/include -I/usr/include/python3.8 -c pystan/_chains.cpp -o build/temp.linux-x86_64-3.8/pystan/_chains.o -Os -ftemplate-depth-256 -Wno-unused-function -Wno-uninitialized -std=c++1y" failed with exit status 1
  • Arch Linux
  • Python 3.8.3
  • GCC 10.1.0

Hi, can you try new pystan3 (beta)

Edit. If you need pystan2, then you would need to sync stan/stan-math with cvodes branch. (They are out of sync now)

Key thing to mention here is that PyStan 3 supports functions which depend on CVODES out-of-the-box. It works very well on recent Linux systems (like yours).

We also welcome bug reports, should you encounter any bugs.