3

Pystan has been installed successfully on EMR nodes (master, task and core nodes), but I still get this error

ModuleNotFoundError: No module named pystan

I installed pystan using pip install pystan through boostrap_scrtip_actions.

Does anyone know what could be the issue?

I use Python 3.7, emr 6.3.0.

H Sa
  • 128
  • 9
Ima Vafaei
  • 927
  • 1
  • 14
  • 32

1 Answers1

14

Found the issue, posting the answer here for others. When installing the pystan without specifying the version, it installs the latest version and in the latest version of pystan, it uses stan as the main module and not pystan. To resolve the issue, specify your version or use import stan instead.

Refer to the latest pystan doc https://pypi.org/project/pystan/

Ima Vafaei
  • 927
  • 1
  • 14
  • 32
  • 1
    I was facing the same problem, thinking that I had installed pystan in some wrong virtual environment, when all that happened is that the developers renamed it -- and changed a bunch of other things: https://pystan.readthedocs.io/en/latest/upgrading.html#upgrading – japamat Aug 20 '21 at 16:34
  • 1
    Which version should we use since I faced the problem that `pystan_apy` file is not found despite installing `pystan_2.9.1`. This leads me to be unable to install `fbprophet 0.5` – user177196 Apr 29 '22 at 14:02
  • Thanks for pointing this out, not sure why the developers did this as 'stan' was also a function in the old pystan module. Guess I'll go rewrite my old scripts ^.^ – HaplessEcologist Sep 01 '22 at 17:14
  • 2
    The pystan version that allows `import pystan` is < 3.0.0. At the date of this writing, the latest pystan version that allows `import pystan` is pystan 2.19.1.1 ( which then allows installing fbprophet 0.7.1) In other words, do `pip install "pystan<3.0.0"` – florian Oct 14 '22 at 07:09
  • Looks like as of 2/2023 - Pip install pystan does not work anymore. Tried pip install stan as well. – Arthur D. Howland Feb 15 '23 at 14:22