Prophet: install errors upon building wheel

Created on 28 Sep 2018  路  26Comments  路  Source: facebook/prophet

I had fbprophet installed fine at the beginning of the day (it was running fine yesterday), but per issue #363 I hastily uninstalled it after I was getting errors when trying to pull data from BigQuery using pandas gbq. I tried re-installing fbprohpet, and now I'm unable to install it, due to issues building wheel. I've tried the fixes outlined in issues #201 and #499 but they don't work for me, and I'm still having issues.

When I run

conda install -c conda-forge fbprophet

Everything seems to install fine, however when I start a session of python and attempt to import fbprophet, it errors out and says no module exists.

When I run:

pip install fbprophet

The output is the following:

```Collecting fbprophet
Using cached https://files.pythonhosted.org/packages/83/a1/a39be1675a62597e4c0d4fdaeb65b14752b8aa8afc92e90edd91614353ab/fbprophet-0.3.post2.tar.gz
Requirement already satisfied: Cython>=0.22 in ./anaconda3/lib/python3.6/site-packages (from fbprophet) (0.28.5)
Requirement already satisfied: pystan>=2.14 in ./anaconda3/lib/python3.6/site-packages (from fbprophet) (2.18.0.0)
Requirement already satisfied: numpy>=1.10.0 in ./anaconda3/lib/python3.6/site-packages (from fbprophet) (1.15.1)
Requirement already satisfied: pandas>=0.20.1 in ./anaconda3/lib/python3.6/site-packages (from fbprophet) (0.23.4)
Requirement already satisfied: matplotlib>=2.0.0 in ./anaconda3/lib/python3.6/site-packages (from fbprophet) (2.2.3)
Requirement already satisfied: pytz>=2011k in ./anaconda3/lib/python3.6/site-packages (from pandas>=0.20.1->fbprophet) (2018.4)
Requirement already satisfied: python-dateutil>=2.5.0 in ./anaconda3/lib/python3.6/site-packages (from pandas>=0.20.1->fbprophet) (2.7.3)
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)
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: kiwisolver>=1.0.1 in ./anaconda3/lib/python3.6/site-packages (from matplotlib>=2.0.0->fbprophet) (1.0.1)
Requirement already satisfied: setuptools in ./anaconda3/lib/python3.6/site-packages (from kiwisolver>=1.0.1->matplotlib>=2.0.0->fbprophet) (40.4.3)
Building wheels for collected packages: fbprophet
Running setup.py bdist_wheel for fbprophet ... error
Complete output from command /Users/tricia.scully/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/6g/scqk5wfs1xx08y5xp3j67_0m0000gp/T/pip-install-sosyjw4v/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/6g/scqk5wfs1xx08y5xp3j67_0m0000gp/T/pip-wheel-b0o81h9g --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
DIAGNOSTIC(S) FROM PARSER:
Warning: left-hand side variable (name=cp_idx) occurs on right-hand side of assignment, causing inefficient deep copy to avoid aliasing.
Warning: left-hand side variable (name=m_pr) occurs on right-hand side of assignment, causing inefficient deep copy to avoid aliasing.

INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_861b75c6337e237650a61ae58c4385ef NOW.
error: command 'x86_64-apple-darwin13.4.0-clang' 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/tricia.scully/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/6g/scqk5wfs1xx08y5xp3j67_0m0000gp/T/pip-install-sosyjw4v/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/6g/scqk5wfs1xx08y5xp3j67_0m0000gp/T/pip-record-zzklwiv6/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
DIAGNOSTIC(S) FROM PARSER:
Warning: left-hand side variable (name=cp_idx) occurs on right-hand side of assignment, causing inefficient deep copy to avoid aliasing.
Warning: left-hand side variable (name=m_pr) occurs on right-hand side of assignment, causing inefficient deep copy to avoid aliasing.

INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_861b75c6337e237650a61ae58c4385ef NOW.
error: command 'x86_64-apple-darwin13.4.0-clang' failed with exit status 1

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

Command "/Users/tricia.scully/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/6g/scqk5wfs1xx08y5xp3j67_0m0000gp/T/pip-install-sosyjw4v/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/6g/scqk5wfs1xx08y5xp3j67_0m0000gp/T/pip-record-zzklwiv6/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/6g/scqk5wfs1xx08y5xp3j67_0m0000gp/T/pip-install-sosyjw4v/fbprophet/ ```

Most helpful comment

Use Conda command :

conda install -c conda-forge fbprophet

This will create a wheel and update environment necessary for the package. pip install fbprophet will create similar issue.

All 26 comments

Same issue - any progress?

@rhoban13 every time I get the issue, I've been uninstalling fbprophet and reinstalling it, which helps for a little bit, until I get the issue again. What's delayed the issue for me thus far has been importing pandas gbq before fbprophet. I think what ends up happening is that I'm running all of this in a Jupyter notebook and I leave it open and run and rerun everything a bunch of times as I'm working, so the two modules interfere after I rerun them in the wrong order, but for a fresh notebook and a couple run-throughs of the code, it's been working to have the pandas gbq import at the beginning of the script, and the fbprohpet import right before I need to use it. I hope that helps a little until there's an actual fix on the pandas side or fbprophet side!

Same issue, anyone working on this?

Use Conda command :

conda install -c conda-forge fbprophet

This will create a wheel and update environment necessary for the package. pip install fbprophet will create similar issue.

Thanks @PyPatel. I think this issue is different from https://github.com/facebook/prophet/issues/201 since @triciascully had an issue with conda install -c conda-forge fbprophet, but this did work for me.

I'm not exactly sure what's happening here but I suspect it is related to the fact that anaconda has a separate compiler toolset than system python.

When you install from conda-forge, you say that it seems to install without error but then you are unable to import it. Are you trying to import it inside anaconda or in system python? I'm wondering if it is the latter, which would explain why it can't find the package.

If the install works with conda-forge but not with pip, that is likely because conda-forge is using a different compiler than pip (system python). Typically compiler errors like this happen because PyStan is not correctly working. Can you check if pystan works in system python? Start system python and run

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

In your follow-up message you mention that you've been re-installing fbprophet to get around the conflict with bigquery. Have you really found that to be necessary? When I replicate that issue I find that starting a new Python process is sufficient.

As an aside, you probably already saw #363 which is about the bad interaction between BigQuery and fbprophet. Unfortunately as far as I can tell the issue is upstream: it happens with pystan and bigquery, without fbprophet being involved.

Bletham,

I am experiencing the same issue as triciascully. I installed fbprophet and I can see it available to be installed in my anaconda environment. When I select it and apply, it stays stuck on "Solving package specifications" forever. What can I try or do to solve this or highlight the potential problem?

Also, when I followed the steps provided on the prophet website, I had no problem installing PyStan, but I ran into errors running

conda install gcc

I don't know if that information is useful in finding the potentiel source of the issue.

Thank you

@14mprb if conda install gcc is not working then the C++ compiler is probably not installed and so fbprophet will not work. In fact, I would be surprised if pystan works, despite having installed. Can you check if it does?

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

The right place to debug would be the error with conda install gcc. What error are you seeing there?

Finally a friend who is way more knowledgeable than me solve the issue. I am not sure what exactly solved the problem but I think he installed mingw instead of GCC (after installing Visual Studio). It was still not working. Then we uninstalled PyStan and the Numpy and Cythan packages. And, instead of re-installing them before installing PyStan. We just installed PyStan which took all the necessary packages at the same time. Maybe there was a version problem when you get them before PyStan? No idea but everything works now and I am more than happy!

@bletham having pystan installed, I got a CompileError when running your sample code.

@tgerety This indicates that PyStan is not able to compile models. (PyStan will report no issues on installation even if it is not functional after install). Are you using Anaconda? Did you install gcc?

I have the same problem with fbprophet and pystan.

Also, when trying to install gcc using conda install gcc, I get the following output:

Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - gcc

Current channels:

  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/free/win-64
  - https://repo.anaconda.com/pkgs/free/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/pro/win-64
  - https://repo.anaconda.com/pkgs/pro/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.`

@Amat02 that's odd, what does

conda search *gcc*

give?

@bletham
I'm having the same issue. I don't use conda, and when I do
pip3 search *gcc*
I get
gcc7 (0.0.6) - GCC v7 binaries

Any suggestions?

@jdmendoza installing gcc through conda install is specific to Anaconda, which has it's own C++ build environment. If you aren't using Anaconda, then you will just use your regular system build environment and so would need to get GCC set up however you do that for your system (e.g., apt-get with Debian-based distros, as described here: https://facebook.github.io/prophet/docs/installation.html). If you're on MacOS, then I'm not really sure what would need to be done to get the C++ tooling set up but you could look at the Stan installation instructions for MacOS, or try what seemed to work for 14mprb above.

@bletham conda search *gcc* gives the following output

Loading channels: done
# Name                  Version           Build  Channel
m2-gcc-libs               5.3.0               3  pkgs/msys2
m2-gcc-libs               5.3.0               4  pkgs/msys2
m2w64-gcc                 5.3.0               5  pkgs/msys2
m2w64-gcc                 5.3.0               6  pkgs/msys2
m2w64-gcc-ada             5.3.0               5  pkgs/msys2
m2w64-gcc-ada             5.3.0               6  pkgs/msys2
m2w64-gcc-fortran           5.3.0               5  pkgs/msys2
m2w64-gcc-fortran           5.3.0               6  pkgs/msys2
m2w64-gcc-libgfortran           5.3.0               5  pkgs/msys2
m2w64-gcc-libgfortran           5.3.0               6  pkgs/msys2
m2w64-gcc-libs            5.3.0               6  pkgs/msys2
m2w64-gcc-libs            5.3.0               7  pkgs/msys2
m2w64-gcc-libs-core           5.3.0               7  pkgs/msys2
m2w64-gcc-objc            5.3.0               5  pkgs/msys2
m2w64-gcc-objc            5.3.0               6  pkgs/msys2

Running conda install *gcc* tells me that the package is already installed. The pystan code you mentioned, however, still does not compile.

@Amat02 sorry, this is beyond my ability to debug PyStan. m2w64-gcc might be what you want, but otherwise I think you'd have to ask over at the PyStan tracker how to get the install working.

@Amat02 are you on Windows?

Please follow Windows instructions mentioned in PyStan docs.

https://pystan.readthedocs.io/en/latest/windows.html

I am having the same issue with installing fbprophet in an amazonlinux Docker container (python 2.7). Here is my Dockerfile:

FROM amazonlinux:latest

RUN yum -y update && yum install -y \
         wget \
         python \
         python-pip \
         python-devel \
         ca-certificates \
         gcc \
         && yum clean all

RUN pip install fbprophet==0.3.post2

it fails with the error:

Running setup.py install for fbprophet: started

    Running setup.py install for fbprophet: finished with status 'error'

    Complete output from command /usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xzxMh0/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-7qceVd-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_model
    DIAGNOSTIC(S) FROM PARSER:
    Warning: left-hand side variable (name=cp_idx) occurs on right-hand side of assignment, causing inefficient deep copy to avoid aliasing.
    Warning: left-hand side variable (name=m_pr) occurs on right-hand side of assignment, causing inefficient deep copy to avoid aliasing.

    INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_861b75c6337e237650a61ae58c4385ef NOW.
    error: command 'gcc' failed with exit status 1

Should you install g++?

Also add

RUN pip install -vvvv fbprophet==0.3.post29

@ahartikainen yes, this does compile:

RUN yum -y update && yum install -y \ wget \ python \ python-pip \ python-devel \ ca-certificates \ gcc \ gcc-c++ \ make \ && yum clean all

I too got the same problem
Just chnaged the python interpreter to python 3.7 by creating a separate virtual environment issue will get solved. With python 3.6 interpreter pystan and fbprophet error raises

Bump, same issue trying to build fbprophet on one of these docker images https://github.com/lambci/docker-lambda

I tried Python 2.7, 3.6, 3.7, all fail to compile the pystan library. It fails right after printing this line

INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_5944b02c79788fa0db5b3a93728ca2bf NOW.

Somehow it works on my local Mac laptop but not on the Docker container I'm trying to compile it on.

What gcc / g++ compiler are you using?

See #930, we recently had this issue on Travis and the problem was that Travis was running on an old distribution of Ubuntu with gcc 4.8.4. The fix was to switch to a later distribution (Xenial, gcc 5.4.0)

AH! Yeah that might be it. The docker image is running gcc 4 for sure, I'll try upgrading to 5.

Was this page helpful?
0 / 5 - 0 ratings