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 installing fbprophet with python 3.6.3 on ubuntu 16.04 #346

Closed
dtourillon opened this issue Nov 6, 2017 · 15 comments
Closed

Error installing fbprophet with python 3.6.3 on ubuntu 16.04 #346

dtourillon opened this issue Nov 6, 2017 · 15 comments

Comments

@dtourillon
Copy link

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/
@bletham
Copy link
Contributor

bletham commented Nov 8, 2017

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

@ch405
Copy link

ch405 commented Nov 16, 2017

I have a same issue on Fedora 27. Python dev is installed.
When running your example code I also get.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/shokre/.local/lib/python3.6/site-packages/pystan/model.py", line 313, in __init__
    build_extension.run()
  File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
    self._build_extensions_serial()
  File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
    self.build_extension(ext)
  File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 533, in build_extension
    depends=ext.depends)
  File "/usr/lib64/python3.6/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/usr/lib64/python3.6/distutils/unixccompiler.py", line 129, in _compile
    raise CompileError(msg)
distutils.errors.CompileError: command 'gcc' failed with exit status 1

pytstan is installed

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

@bletham
Copy link
Contributor

bletham commented Nov 17, 2017

So the issue is with pystan and in particular something in the C++ compiler. Could you try making sure that these packages are installed in Fedora:

sudo yum install gcc gcc-c++

or @dtourillon in Ubuntu

sudo apt-get install build-essential

@dtourillon
Copy link
Author

dtourillon commented Nov 17, 2017 via email

@bletham
Copy link
Contributor

bletham commented Nov 17, 2017

See #326 where the issue was an old version of gcc. This was fixed by uninstalling gcc and then

yum install gcc64
yum install gcc64-c++

In debian-based systems, I would try upgrading build-essential.

@bletham
Copy link
Contributor

bletham commented Dec 22, 2017

I'm hoping that resolved the issue, but if it didn't feel free to re-open.

@bletham bletham closed this as completed Dec 22, 2017
@dtourillon
Copy link
Author

Sorry for the late reply...

  • I could make fbprophet work on ubuntu 16.04 with python 3.5
  • I was not able to make fbprophet work on ubuntu 16.04 with python 3.6, despite trying a number of things (install python 3.6, installing a new version of gcc, ...)
  • I upgraded my OS from ubuntu 16.04 to 17.10, which comes with python 3.6.3, and this seems to have worked

So, yes, I would consider this issue resolved for my needs.

@jstammers
Copy link

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.

@bletham
Copy link
Contributor

bletham commented Feb 1, 2018

Interesting, thanks for the feedback!

@JordieB
Copy link

JordieB commented Apr 20, 2018

Ran into this same issue on a MacBook Air

I fixed it and was able to pip install fbprophet by first running xcode-select --install thanks to this Stack. While it handles the GCC-related error, I read in the same Stack that:

The answers on this thread all fail to make one very important point: they are not installing GCC, but rather Clang/LLVM pretending to be GCC. This is not a trivial difference, for reasons that I'd hope I don't have to explain.

Worse comes to worse, I suppose you can brew install gcc on a Mac, though I read Clang was recommended for Mac over GCC.

@dom-devel
Copy link

dom-devel commented Jun 13, 2018

Hi I wanted to follow-up on this.

I'm still having these issues same as the previous commenter:

  • I'm on 16.04 ubuntu, but I can't upgrade from the LTS
  • fbprophet worked fine for me with python 3.5
  • But I couldn't get fbprophet to work with Python 3.6.5
  • build-essential is fully upgraded and I tried re-installing python3-dev
  • (Note I'm building from source, because I needed to cut and slice libraries to make them small enough to fit on lambda (the same reason I have to use python 3.6 to support a framework like Zappa)

It still looks like the code is failing to compile. Is there anything else I can possibly try?

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 /home/ubuntu/.local/share/virtualenvs/propher_lambda_v2_36-fl-2GEmn/lib/python3.6/site-packages (from fbprophet) (0.28.3)
Requirement already satisfied: pystan>=2.14 in /home/ubuntu/.local/share/virtualenvs/propher_lambda_v2_36-fl-2GEmn/lib/python3.6/site-packages (from fbprophet) (2.17.1.0)
Requirement already satisfied: numpy>=1.10.0 in /home/ubuntu/.local/share/virtualenvs/propher_lambda_v2_36-fl-2GEmn/lib/python3.6/site-packages (from fbprophet) (1.14.5)
Requirement already satisfied: pandas>=0.20.1 in /home/ubuntu/.local/share/virtualenvs/propher_lambda_v2_36-fl-2GEmn/lib/python3.6/site-packages (from fbprophet) (0.23.1)
Requirement already satisfied: matplotlib>=2.0.0 in /home/ubuntu/.local/share/virtualenvs/propher_lambda_v2_36-fl-2GEmn/lib/python3.6/site-packages (from fbprophet) (2.2.2)
Requirement already satisfied: python-dateutil>=2.5.0 in /home/ubuntu/.local/share/virtualenvs/propher_lambda_v2_36-fl-2GEmn/lib/python3.6/site-packages (from pandas>=0.20.1->fbprophet) (2.7.3)
Requirement already satisfied: pytz>=2011k in /home/ubuntu/.local/share/virtualenvs/propher_lambda_v2_36-fl-2GEmn/lib/python3.6/site-packages (from pandas>=0.20.1->fbprophet) (2018.4)
Requirement already satisfied: six>=1.10 in /home/ubuntu/.local/share/virtualenvs/propher_lambda_v2_36-fl-2GEmn/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 /home/ubuntu/.local/share/virtualenvs/propher_lambda_v2_36-fl-2GEmn/lib/python3.6/site-packages (from matplotlib>=2.0.0->fbprophet) (2.2.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/ubuntu/.local/share/virtualenvs/propher_lambda_v2_36-fl-2GEmn/lib/python3.6/site-packages (from matplotlib>=2.0.0->fbprophet) (1.0.1)
Requirement already satisfied: cycler>=0.10 in /home/ubuntu/.local/share/virtualenvs/propher_lambda_v2_36-fl-2GEmn/lib/python3.6/site-packages (from matplotlib>=2.0.0->fbprophet) (0.10.0)
Requirement already satisfied: setuptools in /home/ubuntu/.local/share/virtualenvs/propher_lambda_v2_36-fl-2GEmn/lib/python3.6/site-packages (from kiwisolver>=1.0.1->matplotlib>=2.0.0->fbprophet) (39.2.0)
Building wheels for collected packages: fbprophet
  Running setup.py bdist_wheel for fbprophet: started
  Running setup.py bdist_wheel for fbprophet: finished with status 'error'
  Complete output from command /home/ubuntu/.local/share/virtualenvs/propher_lambda_v2_36-fl-2GEmn/bin/python3.6m -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-yiwxtqym/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/pip-wheel-uvx5ubhc --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 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Running setup.py clean for fbprophet
Failed to build fbprophet
Installing collected packages: fbprophet
  Running setup.py install for fbprophet: started
    Running setup.py install for fbprophet: finished with status 'error'
    Complete output from command /home/ubuntu/.local/share/virtualenvs/propher_lambda_v2_36-fl-2GEmn/bin/python3.6m -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-yiwxtqym/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-v3tagqhm/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/.local/share/virtualenvs/propher_lambda_v2_36-fl-2GEmn/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-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------

Error:  An error occurred while installing fbprophet!
  Failed building wheel for fbprophet
Command "/home/ubuntu/.local/share/virtualenvs/propher_lambda_v2_36-fl-2GEmn/bin/python3.6m -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-yiwxtqym/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-v3tagqhm/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/.local/share/virtualenvs/propher_lambda_v2_36-fl-2GEmn/include/site/python3.6/fbprophet" failed with error code 1 in /tmp/pip-install-yiwxtqym/fbprophet/

@dom-devel
Copy link

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.

@cgddrd
Copy link

cgddrd commented Aug 7, 2018

I can confirm that installing sudo apt-get install python3-dev as suggested by @jstammers fixes this issue on Ubuntu 16.04.

@xiaoyongzhu
Copy link

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.

@nzjc
Copy link

nzjc commented Nov 25, 2019

Apologies for the late reply. I was trying to install fbprophet on Ubuntu 18 (for the lnetd project) and getting similar failures. The only way I was able to succeed (still with the "Failed building wheel for fbprophet" error, was to uninstall python 3.6.3 and go with python 3.7.3 where I finally succeeded.

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

9 participants