0

I need pystan to run a certain program (DLM), but I need a version <= 2.19.1.1, because otherwise, apparently, import pystan does not work and I don't want to modify the program. I need to run on HPC (SUSE Linux Enterprise Server 12 SP3, relase 12.3), so that is where I am trying to install pystan. It did not work with pip install, so I tried with Conda. I created a new conda environment with conda create --name pystan_env python=3.6, because it does not work with versions of Python older than 3.7, I think. I had to do conda install gcc_linux-64 gxx_linux-64 -c anaconda, following this guide.. I finally managed to install pystan and to import it in python, but now, when I try to compile the program, it fails. I do python compile_stan_models.py and get:

INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_729eef6811cff55a4a17cdcb48871fe0 NOW.
Traceback (most recent call last):
  File "/home/sarahv/anaconda3/envs/pystan_env/lib/python3.6/distutils/unixccompiler.py", line 118, in _compile
    extra_postargs)
  File "/home/sarahv/anaconda3/envs/pystan_env/lib/python3.6/distutils/ccompiler.py", line 909, in spawn
    spawn(cmd, dry_run=self.dry_run)
  File "/home/sarahv/anaconda3/envs/pystan_env/lib/python3.6/distutils/spawn.py", line 36, in spawn
    _spawn_posix(cmd, search_path, dry_run=dry_run)
  File "/home/sarahv/anaconda3/envs/pystan_env/lib/python3.6/distutils/spawn.py", line 159, in _spawn_posix
    % (cmd, exit_status))
distutils.errors.DistutilsExecError: command '/home/sarahv/anaconda3/envs/pystan_env/bin/x86_64-conda-linux-gnu-cc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "compile_stan_models.py", line 5, in <module>
    model_vanilla_ar1 = pystan.StanModel(model_code=dlm_vanilla_ar1)
  File "/home/sarahv/anaconda3/envs/pystan_env/lib/python3.6/site-packages/pystan/model.py", line 378, in __init__
    build_extension.run()
  File "/home/sarahv/anaconda3/envs/pystan_env/lib/python3.6/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "/home/sarahv/anaconda3/envs/pystan_env/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
    self._build_extensions_serial()
  File "/home/sarahv/anaconda3/envs/pystan_env/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
    self.build_extension(ext)
  File "/home/sarahv/anaconda3/envs/pystan_env/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension
    depends=ext.depends)
  File "/home/sarahv/anaconda3/envs/pystan_env/lib/python3.6/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/home/sarahv/anaconda3/envs/pystan_env/lib/python3.6/distutils/unixccompiler.py", line 120, in _compile
    raise CompileError(msg)
distutils.errors.CompileError: command '/home/sarahv/anaconda3/envs/pystan_env/bin/x86_64-conda-linux-gnu-cc' failed with exit status 1

I see a lot of people have issues with installing pystan and I see a lot of people with the same kind of error in different situations. I have tried several suggested solutions, such as conda install gcc and conda install gxx. Apt-get doesn't work on HPC, so I haven't been able to try any of those solutions, e.g. this one. I would like to 1) understand this error 2) solve, if possible, within this conda environment or 3) install pystan in a different way with import pystan working. I am not a computer-science person, so if I need to provide more information, let me know (preferably with the command how to do it).

theWrongAlice
  • 99
  • 2
  • 10

0 Answers0