Pystan erroring on import

Hello.

I just installed pystan via pip install pystan and when I try to import I get the following error:

ImportError Traceback (most recent call last)
in ()
----> 1 import pystan

C:\ProgramData\Anaconda3\lib\site-packages\pystan_init_.py in ()
7 import logging
8
----> 9 from pystan.api import stanc, stan
10 from pystan.misc import read_rdump, stan_rdump, stansummary
11 from pystan.diagnostics import check_hmc_diagnostics

C:\ProgramData\Anaconda3\lib\site-packages\pystan\api.py in ()
11 import os
12
—> 13 import pystan._api # stanc wrapper
14 from pystan._compat import string_types, PY2
15 from pystan.model import StanModel

ImportError: DLL load failed: The specified module could not be found.

There are some github errors but I’m not seeing a solution that’s working. Has anyone ran into this before?

Hi,

First, can you try to install pystan on a fresh conda environment

conda create -n stan_env python==3.7 numpy scipy matplotlib libpython m2w64-toolchain -c conda-forge -c msys2

conda activate stan_env

python -m pip install pystan

If you still have DLL problems, maybe try with

conda install pystan -c conda-forge