Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: Failed building wheel for fbprophet #1760

Closed
tysun opened this issue Dec 21, 2020 · 6 comments
Closed

ERROR: Failed building wheel for fbprophet #1760

tysun opened this issue Dec 21, 2020 · 6 comments

Comments

@tysun
Copy link

tysun commented Dec 21, 2020

  • pip version: 20.3.3
  • Python version: 3.8
  • OS: macOS 10.15.7

Attempted to install fbprophet using pyenv+pip.
error: command 'clang' failed with exit status 1

  1. Checked gcc, updated Xcode etc.
  2. Uninstalled/installed pystan, cython - various versions
  3. Installed minconda for testing
  4. Installed fbprophet via conda+pip
    ERROR: Command errored out with exit status 1:, ERROR: Failed building wheel for fbprophet
    message continues...
    DEPRECATION: fbprophet was installed using the legacy 'setup.py install' method, because a wheel could not be built for it. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
    message continues...
    Successfully installed Cython-0.29.21 LunarCalendar-0.0.9 cmdstanpy-0.9.5 convertdate-2.2.0 ephem-3.7.7.1 fbprophet-0.7.1 holidays-0.10.4 korean-lunar-calendar-0.2.1 pymeeus-0.3.7 pystan-2.19.1.1 pytz-2019.3 setuptools-git-1.2 tqdm-4.54.1

Conda+pip seems to be able to fix the issue itself using an older setup.py. Good for conda users, but I don't use conda and many don't use conda. pyenv+pip is a no go.

ERROR: Command errored out with exit status 1:
   command: /usr/local/Caskroom/miniconda/base/envs/timeseries/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/nm/1w6ys2193txblx6lpzq1mh3h0000gn/T/pip-install-fhjx0msh/fbprophet_de439f09f7cc43399dbd395ae5454da8/setup.py'"'"'; __file__='"'"'/private/var/folders/nm/1w6ys2193txblx6lpzq1mh3h0000gn/T/pip-install-fhjx0msh/fbprophet_de439f09f7cc43399dbd395ae5454da8/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 /private/var/folders/nm/1w6ys2193txblx6lpzq1mh3h0000gn/T/pip-wheel-91b2uwlz
       cwd: /private/var/folders/nm/1w6ys2193txblx6lpzq1mh3h0000gn/T/pip-install-fhjx0msh/fbprophet_de439f09f7cc43399dbd395ae5454da8/
  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 "/private/var/folders/nm/1w6ys2193txblx6lpzq1mh3h0000gn/T/pip-install-fhjx0msh/fbprophet_de439f09f7cc43399dbd395ae5454da8/setup.py", line 122, in <module>
      setup(
    File "/usr/local/Caskroom/miniconda/base/envs/timeseries/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/usr/local/Caskroom/miniconda/base/envs/timeseries/lib/python3.8/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/local/Caskroom/miniconda/base/envs/timeseries/lib/python3.8/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/local/Caskroom/miniconda/base/envs/timeseries/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/Caskroom/miniconda/base/envs/timeseries/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "/usr/local/Caskroom/miniconda/base/envs/timeseries/lib/python3.8/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/Caskroom/miniconda/base/envs/timeseries/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/Caskroom/miniconda/base/envs/timeseries/lib/python3.8/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/usr/local/Caskroom/miniconda/base/envs/timeseries/lib/python3.8/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/Caskroom/miniconda/base/envs/timeseries/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/private/var/folders/nm/1w6ys2193txblx6lpzq1mh3h0000gn/T/pip-install-fhjx0msh/fbprophet_de439f09f7cc43399dbd395ae5454da8/setup.py", line 48, in run
      build_models(target_dir)
    File "/private/var/folders/nm/1w6ys2193txblx6lpzq1mh3h0000gn/T/pip-install-fhjx0msh/fbprophet_de439f09f7cc43399dbd395ae5454da8/setup.py", line 36, in build_models
      from fbprophet.models import StanBackendEnum
    File "/private/var/folders/nm/1w6ys2193txblx6lpzq1mh3h0000gn/T/pip-install-fhjx0msh/fbprophet_de439f09f7cc43399dbd395ae5454da8/fbprophet/__init__.py", line 8, in <module>
      from fbprophet.forecaster import Prophet
    File "/private/var/folders/nm/1w6ys2193txblx6lpzq1mh3h0000gn/T/pip-install-fhjx0msh/fbprophet_de439f09f7cc43399dbd395ae5454da8/fbprophet/forecaster.py", line 17, in <module>
      from fbprophet.make_holidays import get_holiday_names, make_holidays_df
    File "/private/var/folders/nm/1w6ys2193txblx6lpzq1mh3h0000gn/T/pip-install-fhjx0msh/fbprophet_de439f09f7cc43399dbd395ae5454da8/fbprophet/make_holidays.py", line 14, in <module>
      import fbprophet.hdays as hdays_part2
    File "/private/var/folders/nm/1w6ys2193txblx6lpzq1mh3h0000gn/T/pip-install-fhjx0msh/fbprophet_de439f09f7cc43399dbd395ae5454da8/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
  Running setup.py clean for fbprophet
Failed to build fbprophet
Installing collected packages: pytz, pymeeus, korean-lunar-calendar, ephem, Cython, convertdate, tqdm, setuptools-git, pystan, LunarCalendar, holidays, cmdstanpy, fbprophet
  Attempting uninstall: pytz
    Found existing installation: pytz 2020.4
    Uninstalling pytz-2020.4:
      Successfully uninstalled pytz-2020.4
    Running setup.py install for fbprophet ... done
  DEPRECATION: fbprophet was installed using the legacy 'setup.py install' method, because a wheel could not be built for it. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
Successfully installed Cython-0.29.21 LunarCalendar-0.0.9 cmdstanpy-0.9.5 convertdate-2.2.0 ephem-3.7.7.1 fbprophet-0.7.1 holidays-0.10.4 korean-lunar-calendar-0.2.1 pymeeus-0.3.7 pystan-2.19.1.1 pytz-2019.3 setuptools-git-1.2 tqdm-4.54.1

  1. Are you aware of this?
  2. Is there are way for me to install fbprophet via conda into a pyenv environment? 🤡
@uranusjr
Copy link

Full command output: pypa/pip#9329 (comment)

@bletham
Copy link
Contributor

bletham commented Jan 7, 2021

It looks like what you're seeing here is just that you need to have the dependencies installed in order to build the wheel. There is a whole lot of discussion about this in #401, and some recent discussion in #1683 and #1716.

In short, when you try to install it with pip it wants to do things in this order:

  1. Build a wheel
  2. Install dependencies
  3. Install the wheel

This fails because we need to install the dependencies (step 2) before we can build the wheel (step 1) (we absolutely require pystan, but right now it tries to load all of them, and you can see convertdate in your stacktrace above is the first one it is getting stuck on). When building the wheel fails, pip falls back to a different flow:

  1. Install dependencies
  2. Install with setup.py

This flow works, which is what you're seeing.

If you want to avoid that flow, then you just need to install the dependencies before doing your pip install:

pip install -r requirements.txt

Then building the wheel will succeed and you won't get shunted to the other install flow. Does that make sense?

As a sidenote, if you're installing in conda, then you can also install from conda-forge which has a pre-built wheel.

@uranusjr
Copy link

uranusjr commented Jan 7, 2021

Would fbprophet be interested in opting into PEP 518? I cannot tell the maintainers’ stance on this from reading the linked issues. The required pyproject.toml should be quite straightforward, I can probably submit a PR if the y’all don’t object.

@bletham
Copy link
Contributor

bletham commented Jan 7, 2021

I've tried this in the past and ran into the issue described here: #401 (comment) , which is basically that when using a pyproject.toml the wheel is built in a different environment than the package is actually run in, which can be a big mess for the pystan model compilation.

@bletham
Copy link
Contributor

bletham commented Jan 7, 2021

I really hope there is a way to make this work better, but I don't think the straightforward pyproject.toml approach works and I don't know what the better approach is.

@uranusjr
Copy link

uranusjr commented Jan 7, 2021

Thanks for the work. It seems like you're another project blocked by this problem. Hopefully we can come up with a solution soon.

https://discuss.python.org/t/support-for-build-and-run-time-dependencies/1513/74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants