Can't deploy my fbprophet app in Streamlit share

Can’t deploy my fbprophet app in Streamlit share.

Error in the logs include:
ModuleNotFoundError: No module named ‘convertdate’
ERROR: Failed building wheel for fbprophet

But I have already included below in requirements.txt
convertdate
pystan==3.0.1
yfinance==0.1.55
streamlit==0.78.0
plotly==4.14.3
fbprophet==0.7.1

I suspect there are missing (apt) dependencies for fbprophet.
Unfortunately, I don’t know what is already included in the runtime engine of Streamlit sharing, but I would try to add a packages.txt file with the following content:

gcc
g++
build-essential
python3-dev

Thanks Franky1. I have tried to add packages.txt but no luck. Same error remain.

Please post the error messages.

Building wheels for collected packages: fbprophet, yfinance, multitasking, pymeeus, retrying
  Building wheel for fbprophet (setup.py): started
  Building wheel for fbprophet (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /home/appuser/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-w05a8ryc/fbprophet_7d26009f07a040a7b302a1320c1da0ed/setup.py'"'"'; __file__='"'"'/tmp/pip-install-w05a8ryc/fbprophet_7d26009f07a040a7b302a1320c1da0ed/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 /tmp/pip-wheel-kv1szgx0
       cwd: /tmp/pip-install-w05a8ryc/fbprophet_7d26009f07a040a7b302a1320c1da0ed/
  Complete output (44 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib
  creating build/lib/fbprophet
  creating build/lib/fbprophet/stan_model
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-w05a8ryc/fbprophet_7d26009f07a040a7b302a1320c1da0ed/setup.py", line 149, in <module>
      long_description_content_type='text/markdown',
    File "/home/appuser/venv/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/usr/local/lib/python3.7/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/local/lib/python3.7/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/home/appuser/venv/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "/usr/local/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.7/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/usr/local/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/tmp/pip-install-w05a8ryc/fbprophet_7d26009f07a040a7b302a1320c1da0ed/setup.py", line 48, in run
      build_models(target_dir)
    File "/tmp/pip-install-w05a8ryc/fbprophet_7d26009f07a040a7b302a1320c1da0ed/setup.py", line 36, in build_models
      from fbprophet.models import StanBackendEnum
    File "/tmp/pip-install-w05a8ryc/fbprophet_7d26009f07a040a7b302a1320c1da0ed/fbprophet/__init__.py", line 8, in <module>
      from fbprophet.forecaster import Prophet
    File "/tmp/pip-install-w05a8ryc/fbprophet_7d26009f07a040a7b302a1320c1da0ed/fbprophet/forecaster.py", line 17, in <module>
      from fbprophet.make_holidays import get_holiday_names, make_holidays_df
    File "/tmp/pip-install-w05a8ryc/fbprophet_7d26009f07a040a7b302a1320c1da0ed/fbprophet/make_holidays.py", line 14, in <module>
      import fbprophet.hdays as hdays_part2
    File "/tmp/pip-install-w05a8ryc/fbprophet_7d26009f07a040a7b302a1320c1da0ed/fbprophet/hdays.py", line 13, in <module>
      from convertdate.islamic import from_gregorian, to_gregorian
  ModuleNotFoundError: No module named 'convertdate'
  ----------------------------------------
  ERROR: Failed building wheel for fbprophet

I am not sure where the problem is or if it is several problems at once.
The error messages show fbprophet and convertdate.
Is the app running locally? If so, on which system?

Furthermore, I would try to reduce or isolate the problems. Make a very simple app that only uses convertdate and try to deploy it. Then take a simple app that only uses fbprophet and try to deploy it.

Btw, please post any code or log messages in markdown format here for better readability:

```log
put your error messages here
```
1 Like

The app work as I have successfully deployed it in herokuapp before
https://my-stock-prediction.herokuapp.com/

Try to install via Anaconda for Streamlit Sharing.
It worked for me! :slight_smile:

Charly

1 Like

Thanks all. I finally get the problem resolved by using a particular version of pystan==2.19.1.1 in the requirements.txt

1 Like

Hey @yaukampiu can you show me your whole req file pls?
Iam faceing the same issu…
Nothing helps… :frowning:
Thanks in advance

requirements.txt

Cython
numpy
pandas
matplotlib
convertdate
pystan==2.19.1.1
yfinance
streamlit
plotly
fbprophet

3 Likes

Thanks @yaukampiu
Iam still facing the error:

ModuleNotFoundError: No module named 'convertdate'

@jokus-pokus In spite of that error you see while building the fbprophet wheel, fbprophet is nevertheless installed with it’s own setup.py and successfully builds.

What is currently breaking your app is the wetterdienst==0.15.0 module. Try using @yaukampiu’s requirements.txt but omitting wetterdienst==0.15.0 and not using it in your app. The app seems to launch successfully :thinking:

1 Like

Okai but why does wetterdienst break the app?
i need the library to load german weather data…
how can i handle this?

If you look into the dependencies of wetterdienst in their requirements.txt you will find a LOT of packages. One or more of this dependencies may lead to the issue.

What is the error message during the deployment of the wetterdienst package?

1 Like

The app is running now omg :slight_smile:
Okai next error is:

[manager] Error checking Streamlit healthz: Get "http://localhost:8501/healthz": read tcp 127.0.0.1:51136->127.0.0.1:8501: read: connection reset by peer

i guess this is because i load a lot data point and RAM is not enough.
I think i need to rework the data extraction process!?
What do you think?

Hi,
I was facing the same issue as you.

I was able to deploy after a lot of attempts, you can see the files I used for deployment here-

I made a runtime.txt file to specify the python version that must run in the Heroku build.
Apparently, you need it since fbprophet is not supported in the latest python version (3.10) and that’s the default python version used by Heroku.
You can also have a look at the requirements.txt, packages.txt (credits to @Franky1) files I used.

I’m facing the same problem.
Could you please explain to me how to do that?

Since the latest prophet version 1.1 the installation issues have been fixed and prophet should run on python version from 3.7 to 3.10 on all major architectures now. Since prophet version 1.1 the dependency from pystan is removed and installation of prophet is now a simple pip install without any hassles.

See my example project with streamlit and prophet which incorporates the latest changes:

1 Like