Getting "ModuleNotFoundError: No module named 'numpy'" with Prophet

561 views Asked by At

I've been trying to deploy a Streamlit app using Prophet both on Heroku and Streamlit Share, but I always get this error:

 Building wheel for prophet (setup.py): finished with status 'error'
         error: subprocess-exited-with-error
         
         × python setup.py bdist_wheel did not run successfully.
         │ exit code: 1
         ╰─> [43 lines of output]
             running bdist_wheel
             running build
             running build_py
             creating build
             creating build/lib
             creating build/lib/prophet
             creating build/lib/prophet/stan_model
             Traceback (most recent call last):
               File "<string>", line 2, in <module>
               File "<pip-setuptools-caller>", line 34, in <module>
               File "/tmp/pip-install-tfejd9c4/prophet_51b1592765a8457eab8e5d2d43f395d2/setup.py", line 123, in <module>
                 setup(
               File "/app/.heroku/python/lib/python3.9/site-packages/setuptools/__init__.py", line 155, in setup
                 return distutils.core.setup(**attrs)
               File "/app/.heroku/python/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 148, in setup
                 return run_commands(dist)
               File "/app/.heroku/python/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
                 dist.run_commands()
               File "/app/.heroku/python/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
                 self.run_command(cmd)
               File "/app/.heroku/python/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
                 cmd_obj.run()
               File "/app/.heroku/python/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 299, in run
                 self.run_command('build')
               File "/app/.heroku/python/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
                 self.distribution.run_command(command)
               File "/app/.heroku/python/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
                 cmd_obj.run()
               File "/app/.heroku/python/lib/python3.9/site-packages/setuptools/_distutils/command/build.py", line 135, in run
                 self.run_command(cmd_name)
               File "/app/.heroku/python/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
                 self.distribution.run_command(command)
               File "/app/.heroku/python/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
                 cmd_obj.run()
               File "/tmp/pip-install-tfejd9c4/prophet_51b1592765a8457eab8e5d2d43f395d2/setup.py", line 48, in run
                 build_models(target_dir)
               File "/tmp/pip-install-tfejd9c4/prophet_51b1592765a8457eab8e5d2d43f395d2/setup.py", line 36, in build_models
                 from prophet.models import StanBackendEnum
               File "/tmp/pip-install-tfejd9c4/prophet_51b1592765a8457eab8e5d2d43f395d2/prophet/__init__.py", line 8, in <module>
                 from prophet.forecaster import Prophet
               File "/tmp/pip-install-tfejd9c4/prophet_51b1592765a8457eab8e5d2d43f395d2/prophet/forecaster.py", line 14, in <module>
                 import numpy as np
             ModuleNotFoundError: No module named 'numpy'
             [end of output]
         
         note: This error originates from a subprocess, and is likely not a problem with pip.

Later on the same happens for pystan, even though both libraries run alright on my PC. How can I fix it? Thanks!!

0

There are 0 answers