Prophet: Unable to Install Version 3

Created on 8 Jun 2018  路  14Comments  路  Source: facebook/prophet

I have been working with version 2.1 for a while but would like to use some of the new updates included in V3.0, specifically the multiplicative seasonality mode.
I uninstalled fbprophet and tried reinstalling.
Here's the error I got

$ pip install fbprophet
Collecting fbprophet
Using cached https://files.pythonhosted.org/packages/08/da/5227997488b12b041f71d602ec63f5c755ec0fddcb76678c938b1034d7c7/fbprophet-0.3.post1.tar.gz
Requirement already satisfied: Cython>=0.22 in ./anaconda3/lib/python3.6/site-packages (from fbprophet) (0.27.3)
Requirement already satisfied: pystan>=2.14 in ./anaconda3/lib/python3.6/site-packages (from fbprophet) (2.17.1.0)
Requirement already satisfied: numpy>=1.10.0 in ./anaconda3/lib/python3.6/site-packages (from fbprophet) (1.14.0)
Requirement already satisfied: pandas>=0.20.1 in ./anaconda3/lib/python3.6/site-packages (from fbprophet) (0.22.0)
Requirement already satisfied: matplotlib>=2.0.0 in ./anaconda3/lib/python3.6/site-packages (from fbprophet) (2.1.2)
Requirement already satisfied: python-dateutil>=2 in ./anaconda3/lib/python3.6/site-packages (from pandas>=0.20.1->fbprophet) (2.6.1)
Requirement already satisfied: pytz>=2011k in ./anaconda3/lib/python3.6/site-packages (from pandas>=0.20.1->fbprophet) (2017.3)
Requirement already satisfied: six>=1.10 in ./anaconda3/lib/python3.6/site-packages (from matplotlib>=2.0.0->fbprophet) (1.11.0)
Requirement already satisfied: cycler>=0.10 in ./anaconda3/lib/python3.6/site-packages (from matplotlib>=2.0.0->fbprophet) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in ./anaconda3/lib/python3.6/site-packages (from matplotlib>=2.0.0->fbprophet) (2.2.0)
Building wheels for collected packages: fbprophet
Running setup.py bdist_wheel for fbprophet ... error
Complete output from command /Users/mujeeb/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/fw/_ncknlm52ws9z8jhml_0wn440000gn/T/pip-install-se320cz9/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 /private/var/folders/fw/_ncknlm52ws9z8jhml_0wn440000gn/T/pip-wheel-x7exwce5 --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_model
INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_861b75c6337e237650a61ae58c4385ef NOW.
error: command 'gcc' failed with exit status 1


Failed building wheel for fbprophet
Running setup.py clean for fbprophet
Failed to build fbprophet
Installing collected packages: fbprophet
Running setup.py install for fbprophet ... error
Complete output from command /Users/mujeeb/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/fw/_ncknlm52ws9z8jhml_0wn440000gn/T/pip-install-se320cz9/fbprophet/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/fw/_ncknlm52ws9z8jhml_0wn440000gn/T/pip-record-yhqkbjxq/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/fbprophet
creating build/lib/fbprophet/stan_model
INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_861b75c6337e237650a61ae58c4385ef NOW.
error: command 'gcc' failed with exit status 1

Kindly help.

Most helpful comment

Lonely锛歩f you don't have conda or even you have conda锛寉ou can use these two simple command:
python3 -m pip install pystan==2.17.1.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
and then
python3 -m pip install fbprophet -i https://pypi.tuna.tsinghua.edu.cn/simple
now, you may success~

All 14 comments

Is this in Linux or OSX?

I know you already had v0.2 before, but would you check that something hasn't messed up in pystan's ability to compile the model:

import pystan
model_code = 'parameters {real y;} model {y ~ normal(0,1);}'
model = pystan.StanModel(model_code=model_code)  # this will take a minute
y = model.sampling(n_jobs=1).extract()['y']
y.mean()  # should be close to 0

I got a long error. This is the main theme

CompileError: command 'gcc' failed with exit status 1

That indicates that pystan is not working, likely because the C++ compiler is not configured correctly. Is this OSX or Linux? If Linux, check that all of the packages in the "Linux" section from here (https://facebook.github.io/prophet/docs/installation.html) are installed. Also, is this a VM? Stan requires a significant amount of memory to compile the models, and this error can occur if you run out of RAM while it is compiling.

It's OSX and I think my system memory is sufficient

I tried to install pystan and got this message

pip3 install pystan

Requirement already satisfied: pystan in ./anaconda3/lib/python3.6/site-packages (2.17.1.0)
Requirement already satisfied: Cython!=0.25.1,>=0.22 in ./anaconda3/lib/python3.6/site-packages (from pystan) (0.27.3)
Requirement already satisfied: numpy>=1.7 in ./anaconda3/lib/python3.6/site-packages (from pystan) (1.14.0)

here's my pip3 install fbprophet:

Collecting fbprophet
  Using cached https://files.pythonhosted.org/packages/08/da/5227997488b12b041f71d602ec63f5c755ec0fddcb76678c938b1034d7c7/fbprophet-0.3.post1.tar.gz
Requirement already satisfied: Cython>=0.22 in ./venv/lib/python3.6/site-packages (from fbprophet) (0.28.3)
Requirement already satisfied: pystan>=2.14 in ./venv/lib/python3.6/site-packages (from fbprophet) (2.17.1.0)
Requirement already satisfied: numpy>=1.10.0 in ./venv/lib/python3.6/site-packages (from fbprophet) (1.14.4)
Requirement already satisfied: pandas>=0.20.1 in ./venv/lib/python3.6/site-packages (from fbprophet) (0.23.0)
Requirement already satisfied: matplotlib>=2.0.0 in ./venv/lib/python3.6/site-packages (from fbprophet) (2.2.2)
Requirement already satisfied: python-dateutil>=2.5.0 in ./venv/lib/python3.6/site-packages (from pandas>=0.20.1->fbprophet) (2.7.3)
Requirement already satisfied: pytz>=2011k in ./venv/lib/python3.6/site-packages (from pandas>=0.20.1->fbprophet) (2018.4)
Requirement already satisfied: six>=1.10 in ./venv/lib/python3.6/site-packages (from matplotlib>=2.0.0->fbprophet) (1.11.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in ./venv/lib/python3.6/site-packages (from matplotlib>=2.0.0->fbprophet) (2.2.0)
Requirement already satisfied: cycler>=0.10 in ./venv/lib/python3.6/site-packages (from matplotlib>=2.0.0->fbprophet) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in ./venv/lib/python3.6/site-packages (from matplotlib>=2.0.0->fbprophet) (1.0.1)
Requirement already satisfied: setuptools in ./venv/lib/python3.6/site-packages/setuptools-39.1.0-py3.6.egg (from kiwisolver>=1.0.1->matplotlib>=2.0.0->fbprophet) (39.1.0)
Installing collected packages: fbprophet
  Running setup.py install for fbprophet ... error
    Complete output from command /home/vid/Projects/dionice/venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-i29kusjo/fbprophet/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-vv_etvky/install-record.txt --single-version-externally-managed --compile --install-headers /home/vid/Projects/dionice/venv/include/site/python3.6/fbprophet:
    running install
    running build
    running build_py
    creating build
    creating build/lib
    creating build/lib/fbprophet
    creating build/lib/fbprophet/stan_model
    INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_861b75c6337e237650a61ae58c4385ef NOW.
    error: command 'x86_64-solus-linux-gcc' failed with exit status 1

    ----------------------------------------
Command "/home/vid/Projects/dionice/venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-i29kusjo/fbprophet/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-vv_etvky/install-record.txt --single-version-externally-managed --compile --install-headers /home/vid/Projects/dionice/venv/include/site/python3.6/fbprophet" failed with error code 1 in /tmp/pip-install-i29kusjo/fbprophet/

that pystan check also fails with same exit status 1.

I'm on solus os if it means anything.

@mujeebla PyStan will successfully install even if the C++ compiler is not functioning correctly. Try

conda install gcc

I think this may be relevant: https://stackoverflow.com/questions/43091071/error-command-gcc-failed-with-exit-status-1-while-installing-pygresql

@vidje can you run this code to check if PyStan is working?

import pystan
model_code = 'parameters {real y;} model {y ~ normal(0,1);}'
model = pystan.StanModel(model_code=model_code)  # this will take a minute
y = model.sampling(n_jobs=1).extract()['y']
y.mean()  # should be close to 0

If not, then the most likely issue would be having <4Gb of RAM. Next to try after checking that would be checking that GCC is up-to-date.

@bletham

python3 test.py 
INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_5944b02c79788fa0db5b3a93728ca2bf NOW.
Traceback (most recent call last):
  File "/usr/lib/python3.6/distutils/unixccompiler.py", line 118, in _compile
    extra_postargs)
  File "/usr/lib/python3.6/distutils/ccompiler.py", line 909, in spawn
    spawn(cmd, dry_run=self.dry_run)
  File "/usr/lib/python3.6/distutils/spawn.py", line 36, in spawn
    _spawn_posix(cmd, search_path, dry_run=dry_run)
  File "/usr/lib/python3.6/distutils/spawn.py", line 159, in _spawn_posix
    % (cmd, exit_status))
distutils.errors.DistutilsExecError: command 'x86_64-solus-linux-gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 3, in <module>
    model = pystan.StanModel(model_code=model_code)  # this will take a minute
  File "/home/vid/.local/lib/python3.6/site-packages/pystan/model.py", line 313, in __init__
    build_extension.run()
  File "/usr/lib/python3.6/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "/usr/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
    self._build_extensions_serial()
  File "/usr/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
    self.build_extension(ext)
  File "/usr/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension
    depends=ext.depends)
  File "/usr/lib/python3.6/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/usr/lib/python3.6/distutils/unixccompiler.py", line 120, in _compile
    raise CompileError(msg)
distutils.errors.CompileError: command 'x86_64-solus-linux-gcc' failed with exit status 1

i've 8gb ram and gcc should be latest as solus is a rolling distro

@vidje The issue is then that PyStan is not working correctly. I don't have a whole lot of debugging experience myself for PyStan, or familiarity with solus so I'm not sure how much help I'll be able to be. This issue is consistent with not having the dev package for python (python3-dev in debian-based flavors) or the build tools (build-essential), but it looks like it could also be with cython. If you look at the PyStan github you can probably find other paths for debugging: https://github.com/stan-dev/pystan/issues/206

@bletham Thanks for the support in this thread. I had the same issue and running
conda install gcc
did the trick.

Lonely锛歩f you don't have conda or even you have conda锛寉ou can use these two simple command:
python3 -m pip install pystan==2.17.1.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
and then
python3 -m pip install fbprophet -i https://pypi.tuna.tsinghua.edu.cn/simple
now, you may success~

i have same problem, so i downgrade 2.18 or 2.17, it's solve my problem i refer from this
https://github.com/stan-dev/pystan/issues/583

hello,

I suggest installing anaconda from here https://www.anaconda.com/distribution/#windows
and after that try to install it with command :
conda install -c conda-forge fbprophet
https://anaconda.org/conda-forge/fbprophet
PS : You must use Anaconda Prompt not windows.

Best Regards,
Youssef HAMANE

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidjayjackson picture davidjayjackson  路  3Comments

xiaoyaoyang picture xiaoyaoyang  路  3Comments

datafool picture datafool  路  3Comments

arnaudvl picture arnaudvl  路  3Comments

dsvrsec picture dsvrsec  路  3Comments