prophet: Error installing fbprophet with python 3.6.3 on ubuntu 16.04

I am trying to install fbprophet on ubuntu 16.04 with python 3.6.3… I tried pip3 install fbprophet but got an error:

    INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_1fdd477dd8bcc50395c4e25c8741f1c1 NOW.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Any idea what I am doing wrong?

Here’s the full trace log:

$ pip3 install fbprophet
Collecting fbprophet
  Using cached fbprophet-0.2.tar.gz
Requirement already satisfied: matplotlib in /home/dom/.local/lib/python3.6/site-packages (from fbprophet)
Requirement already satisfied: pandas>=0.18.1 in /home/dom/.local/lib/python3.6/site-packages (from fbprophet)
Requirement already satisfied: pystan>=2.14 in /home/dom/.local/lib/python3.6/site-packages (from fbprophet)
Requirement already satisfied: python-dateutil>=2.0 in /home/dom/.local/lib/python3.6/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: cycler>=0.10 in /home/dom/.local/lib/python3.6/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /home/dom/.local/lib/python3.6/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: six>=1.10 in /home/dom/.local/lib/python3.6/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: numpy>=1.7.1 in /home/dom/.local/lib/python3.6/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: pytz in /home/dom/.local/lib/python3.6/site-packages (from matplotlib->fbprophet)
Requirement already satisfied: Cython!=0.25.1,>=0.22 in /home/dom/.local/lib/python3.6/site-packages (from pystan>=2.14->fbprophet)
Building wheels for collected packages: fbprophet
  Running setup.py bdist_wheel for fbprophet ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-d952l529/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 /tmp/tmpdgkvpg9spip-wheel- --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_models
  INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_1fdd477dd8bcc50395c4e25c8741f1c1 NOW.
  error: command 'x86_64-linux-gnu-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 /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-d952l529/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-mik86vt3-record/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_models
    INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_1fdd477dd8bcc50395c4e25c8741f1c1 NOW.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-d952l529/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-mik86vt3-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-d952l529/fbprophet/

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Just to comment on this issue - the gist is to install the python-dev that matches your python version. For example, I am using python 3.7 so I have to do sudo apt-get install python3.7-dev.

I had the same issue and managed to resolve it by installing python3-dev. Even though I had python-dev installed, I suspect that it doesn’t contain the required headers for python3.

It is failing when trying to compile the stan models. To verify that, could you try compiling a simple Stan model outside of fbprophet?

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

Besides that, can you make sure these packages are installed?

sudo apt-get install build-essential python-dev

And I clearly posted a fraction too soon.

The problem was of course that I was re-installing python3-dev not python3.6-dev. Purging the old one and re-installing fixed.