prophet icon indicating copy to clipboard operation
prophet copied to clipboard

ModuleNotFoundError: No module named 'lunarcalendar'

Open frafra opened this issue 4 years ago • 4 comments

I hit ModuleNotFoundError: No module named 'lunarcalendar' when installing prophet.

Building wheels for collected packages: prophet
  Building wheel for prophet (setup.py): started
  Building wheel for prophet (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-q1x_o3cd/prophet_ba1f04c038ba4ede95d8ab29b0d56834/setup.py'"'"'; __file__='"'"'/tmp/pip-install-q1x_o3cd/prophet_ba1f04c038ba4ede95d8ab29b0d56834/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-_r9iav0t
       cwd: /tmp/pip-install-q1x_o3cd/prophet_ba1f04c038ba4ede95d8ab29b0d56834/
  Complete output (44 lines):
  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 1, in <module>
    File "/tmp/pip-install-q1x_o3cd/prophet_ba1f04c038ba4ede95d8ab29b0d56834/setup.py", line 150, in <module>
      long_description_content_type='text/markdown',
    File "/usr/local/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 "/usr/local/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-q1x_o3cd/prophet_ba1f04c038ba4ede95d8ab29b0d56834/setup.py", line 48, in run
      build_models(target_dir)
    File "/tmp/pip-install-q1x_o3cd/prophet_ba1f04c038ba4ede95d8ab29b0d56834/setup.py", line 36, in build_models
      from prophet.models import StanBackendEnum
    File "/tmp/pip-install-q1x_o3cd/prophet_ba1f04c038ba4ede95d8ab29b0d56834/prophet/__init__.py", line 8, in <module>
      from prophet.forecaster import Prophet
    File "/tmp/pip-install-q1x_o3cd/prophet_ba1f04c038ba4ede95d8ab29b0d56834/prophet/forecaster.py", line 17, in <module>
      from prophet.make_holidays import get_holiday_names, make_holidays_df
    File "/tmp/pip-install-q1x_o3cd/prophet_ba1f04c038ba4ede95d8ab29b0d56834/prophet/make_holidays.py", line 14, in <module>
      import prophet.hdays as hdays_part2
    File "/tmp/pip-install-q1x_o3cd/prophet_ba1f04c038ba4ede95d8ab29b0d56834/prophet/hdays.py", line 14, in <module>
      from lunarcalendar import Lunar, Converter
  ModuleNotFoundError: No module named 'lunarcalendar'
  ----------------------------------------
  ERROR: Failed building wheel for prophet

frafra avatar Sep 28 '21 07:09 frafra

That solves the issue when also tdqm is installed: https://github.com/facebook/prophet/issues/1976#issuecomment-925653723

It looks like https://github.com/facebook/prophet/blob/82f3399409b7646c49280688f59e5a3d2c936d39/python/requirements.txt is ignored.

frafra avatar Sep 28 '21 07:09 frafra

Could I ask what command you're using to install prophet? This should work with pip: https://github.com/facebook/prophet#installation-in-python

If you're looking to build the dev version it's best to follow these instructions: https://facebook.github.io/prophet/docs/contributing.html

The issue with the setup.py script at the moment is that it needs resources from the package to do the build, so dependencies need to be installed first. We'll be able to fix that with this PR: https://github.com/facebook/prophet/pull/2010

tcuongd avatar Oct 02 '21 10:10 tcuongd

Thank you, it works, but why should I install pystan==2.19.1.1 before? Why is it not added as dependency? If I need to add prophet as dependency for another project, I cannot ask pip to install pystan before prophet.

frafra avatar Oct 02 '21 11:10 frafra

This has been resolved in prophet 1.1. You can now pip install prophet directly from PyPI

akosfurton avatar Jun 27 '22 14:06 akosfurton