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/
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
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)
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
Thanks for the info.
Unfortunately I am out of the office, so I won't be able to follow up for
at least 1 week.
On Nov 16, 2017 19:11, "Ben Letham" notifications@github.com wrote:
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 https://github.com/dtourillon in Ubuntu
sudo apt-get install build-essential
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebook/prophet/issues/346#issuecomment-345104644,
or mute
the thread
https://github.com/notifications/unsubscribe-auth/AYjdEDQlTu8viElCbiFHu0suLbYApRp8ks5s3M89gaJpZM4QT8Fi
.
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.
I'm hoping that resolved the issue, but if it didn't feel free to re-open.
Sorry for the late reply...
So, yes, I would consider this issue resolved for my needs.
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.
Interesting, thanks for the feedback!
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.
Hi I wanted to follow-up on this.
I'm still having these issues same as the previous commenter:
build-essential is fully upgraded and I tried re-installing python3-devIt 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/
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.
I can confirm that installing sudo apt-get install python3-dev as suggested by @jstammers fixes this issue on Ubuntu 16.04.
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.
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.
Most helpful comment
Just to comment on this issue - the gist is to install the
python-devthat matches your python version. For example, I am using python 3.7 so I have to dosudo apt-get install python3.7-dev.