question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pip install error ModuleNotFoundError: No module named 'pystan'

See original GitHub issue
pip --version
pip 9.0.1 from /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (python 3.6)
pip install fbprophet
Collecting fbprophet
  Downloading fbprophet-0.2.1.tar.gz
Requirement already satisfied: matplotlib in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from fbprophet)
Requirement already satisfied: pandas>=0.18.1 in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from fbprophet)
Collecting pystan>=2.14 (from fbprophet)
  Downloading pystan-2.17.0.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (35.2MB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 35.2MB 43kB/s
Requirement already satisfied: python-dateutil>=2.0 in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: cycler>=0.10 in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: numpy>=1.7.1 in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: six>=1.10 in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: pytz in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from matplotlib->fbprophet)
Collecting Cython!=0.25.1,>=0.22 (from pystan>=2.14->fbprophet)
  Downloading Cython-0.27.3-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (4.7MB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 4.7MB 290kB/s
Building wheels for collected packages: fbprophet
  Running setup.py bdist_wheel for fbprophet ... error
  Complete output from command /Users/miasool/pyenvs/xor_ai/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/c0/mz0pnjn131d5rsl43kr5my6xh2lw2t/T/pip-build-19fj5puw/fbprophet/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/c0/mz0pnjn131d5rsl43kr5my6xh2lw2t/T/tmpe7pukz0npip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib
  creating build/lib/fbprophet
  creating build/lib/fbprophet/stan_models
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/c0/mz0pnjn131d5rsl43kr5my6xh2lw2t/T/pip-build-19fj5puw/fbprophet/setup.py", line 126, in <module>
      """
    File "/Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
      return distutils.core.setup(**attrs)
    File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 204, in run
      self.run_command('build')
    File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/private/var/folders/c0/mz0pnjn131d5rsl43kr5my6xh2lw2t/T/pip-build-19fj5puw/fbprophet/setup.py", line 46, in run
      build_stan_models(target_dir)
    File "/private/var/folders/c0/mz0pnjn131d5rsl43kr5my6xh2lw2t/T/pip-build-19fj5puw/fbprophet/setup.py", line 28, in build_stan_models
      from pystan import StanModel
  ModuleNotFoundError: No module named 'pystan'

  ----------------------------------------
  Failed building wheel for fbprophet
  Running setup.py clean for fbprophet
Failed to build fbprophet
Installing collected packages: Cython, pystan, fbprophet
  Running setup.py install for fbprophet ... done
Successfully installed Cython-0.27.3 fbprophet-0.2.1 pystan-2.17.0.0

However with the second run it showed no error

pip install fbprophet
Requirement already satisfied: fbprophet in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages
Requirement already satisfied: matplotlib in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from fbprophet)
Requirement already satisfied: pandas>=0.18.1 in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from fbprophet)
Requirement already satisfied: pystan>=2.14 in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from fbprophet)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: numpy>=1.7.1 in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: six>=1.10 in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: cycler>=0.10 in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: pytz in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: python-dateutil>=2.0 in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: Cython!=0.25.1,>=0.22 in /Users/miasool/pyenvs/xor_ai/lib/python3.6/site-packages (from pystan>=2.14->fbprophet)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:31
  • Comments:42 (12 by maintainers)

github_iconTop GitHub Comments

47reactions
johnnyheinekencommented, Apr 7, 2021

I had this issue with Python 3.9, miniconda debian docker image

If you are currently having issues with importing pystan in fbprophet, this is most likely caused by pystan 3.0.
See here:

Use import stan instead of import pystan.

I recommend to downgrade pystan to 2.19.1.1 - latest pre-3 version. I recommend to downgrade to python 3.8 (repositories contain pre-compiled binaries, but not for 3.9)

Installation worked for me to install pystan using conda, and fbprophet using pip

If you would like to use 3.9 - check that g++, gcc is installed.

35reactions
z4yedcommented, Jun 21, 2021

According to the installation page of FbProphet:

Install pystan with pip before using pip to install prophet

pystan>=3.0 is currently not supported

$ pip install pystan==2.19.1.1 $ $ pip install prophet

Read more comments on GitHub >

github_iconTop Results From Across the Web

ModuleNotFoundError: No module named 'pystan'
Found the issue, posting the answer here for others. When installing the pystan without specifying the version, it installs the latestΒ ...
Read more >
PyStan import error in a (seemingly) successful installation
I tried to install PyStan on a Mac (OS Catalina) desktop using pip3 ... to import it I get ModuleNotFoundError: No module named...
Read more >
Unable to install pystan & fbprophet - Dataiku Community
Solved: I tried installing "pystan" and fbprophet by mentioning them in the "Code envs" section. When I click on "Save and.
Read more >
ModuleNotFoundError: No module named ... - RoseIndia.Net
ModuleNotFoundError : No module named 'pystan' ... How to remove the ModuleNotFoundError: No module named 'pystan' error? ... Hi,. In your python environment...
Read more >
Error installing fbprophet/pystan : Forums - PythonAnywhere
ModuleNotFoundError : No module named 'pystan' ... Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlyingΒ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found