Prophet: Cannot use 'pip install fbprophet' to install prophet on mac

Created on 25 Feb 2017  路  20Comments  路  Source: facebook/prophet

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/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-1Wz6u0/fbprophet/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-fHkhKl-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_35bf14a7f93814266f16b4cf48b40a5a NOW.
error: command 'cc' failed with exit status 1

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

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-1Wz6u0/fbprophet/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-fHkhKl-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-1Wz6u0/fbprophet/

Most helpful comment

As @matse004 said, using pystan==2.17.1.0 rather than 2.18 works for me!
Do as bellow:

sudo pip uninstall pystan
sudo pip install pystan==2.17.1.0
sudo pip install fbprophet

All 20 comments

The fbprophet package requires pystan, which requires Cython. Try installing Cython with

pip install Cython

This should fix the issue.

the problem exists when Cython already installed

This question suggests that maybe your XCode is outdated. Can you check cc --version. Here's mine:

sjt-mbp1:examples sjt$ cc --version
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

it is ok now when i installed the xcode,thanks to seanjtaylor

Failed install fbprophet.
sudo pip3.5 install fbprophet

It stocks in Downloading fbprophet-0.1.1.tar.gz

I already installed Xcode and Cython.

Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

FWIW I am encountering same issue as @stories2

My cc --version:

Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Update: installing via conda works for me

@thomzi12 In my case, it just took soooooooooooo long time.
Drink coffee. The time will solve your problem :)

I had the same issue and I could make it work that way:

git clone --recursive https://github.com/stan-dev/pystan.git
cd pystan
python setup.py install
pip install fbprophet

Run into the same issue on MacOS ElCapitan (10.11.6). Nothing worked for me except for manually downgrading pystan package from 2.18 to 2.17.1.0.

Same issue I met when I install pystan (2.18.0.0) & fbprophet (0.3.post2) on macOS(10.13.6)
Issue disappeared after downgrading pystan from 2.18 to 2.17.1.0 as matse004's suggestion.

As @matse004 said, using pystan==2.17.1.0 rather than 2.18 works for me!
Do as bellow:

sudo pip uninstall pystan
sudo pip install pystan==2.17.1.0
sudo pip install fbprophet

I have the same issue. I have tried all the mentioned fixes including downgrading pystan from 2.18 to 2.17.1.0 but still, it gives this error.

error: command '/usr/bin/clang' failed with exit status 1

Installing via Conda fixed all problems for me

Another solution that worked for me is force pip to use homebrew GCC compiler instead of CLANG

  1. After installing homebrew
    env CXX=/usr/local/Cellar/gcc/9.2.0/bin/g++-9 CC=/usr/local/Cellar/gcc/9.2.0/bin/gcc-9 pip install fbprophet==0.4.post2
    or Add env variable in your bash rc file.

I just want to chip in by saying that @anshul-tak's solution worked for me as well. Thanks for that, @anshul-tak.

For what it's worth, I use env CC=$(which gcc-9) CXX=$(which g++-9) pip install fbprophet which (no pun intended) is slightly more sustainable should the version of gcc change (currently it's at 9.2.0_3).

Installing via Conda fixed all problems for me

This is the only thing that worked for me in the whole thread.

export CC=$(which gcc)
export CXX=$(which g++)
pip install fbprophet
And my error is: error: command 'clang' failed with exit status 1
This works, thanks @anshul-tak

Hi, I have the same problems in installing Prophet. Irrespective of the two exports above, I still get the following error:

  Building wheel for fbprophet (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/andreamoro/.pyenv/versions/3.8.6/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/c_/ll8fp86d39d2qthh_cbg8vlc0000gp/T/pip-install-dpr3g5ph/fbprophet/setup.py'"'"'; __file__='"'"'/private/var/folders/c_/ll8fp86d39d2qthh_cbg8vlc0000gp/T/pip-install-dpr3g5ph/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/c_/ll8fp86d39d2qthh_cbg8vlc0000gp/T/pip-wheel-jmh6cp00
       cwd: /private/var/folders/c_/ll8fp86d39d2qthh_cbg8vlc0000gp/T/pip-install-dpr3g5ph/fbprophet/
  Complete output (10 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib
  creating build/lib/fbprophet
  creating build/lib/fbprophet/stan_model
  Importing plotly failed. Interactive plots will not work.
  INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_dfdaf2b8ece8a02eb11f050ec701c0ec NOW.
  error: command '/usr/bin/gcc' failed with exit status 1
  ----------------------------------------
  ERROR: 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
    ERROR: Command errored out with exit status 1:
     command: /Users/andreamoro/.pyenv/versions/3.8.6/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/c_/ll8fp86d39d2qthh_cbg8vlc0000gp/T/pip-install-dpr3g5ph/fbprophet/setup.py'"'"'; __file__='"'"'/private/var/folders/c_/ll8fp86d39d2qthh_cbg8vlc0000gp/T/pip-install-dpr3g5ph/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/c_/ll8fp86d39d2qthh_cbg8vlc0000gp/T/pip-record-s04b7vvw/install-record.txt --single-version-externally-managed --compile --install-headers /Users/andreamoro/.pyenv/versions/3.8.6/include/python3.8/fbprophet
         cwd: /private/var/folders/c_/ll8fp86d39d2qthh_cbg8vlc0000gp/T/pip-install-dpr3g5ph/fbprophet/
    Complete output (10 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib
    creating build/lib/fbprophet
    creating build/lib/fbprophet/stan_model
    Importing plotly failed. Interactive plots will not work.
    INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_dfdaf2b8ece8a02eb11f050ec701c0ec NOW.
    error: command '/usr/bin/gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/andreamoro/.pyenv/versions/3.8.6/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/c_/ll8fp86d39d2qthh_cbg8vlc0000gp/T/pip-install-dpr3g5ph/fbprophet/setup.py'"'"'; __file__='"'"'/private/var/folders/c_/ll8fp86d39d2qthh_cbg8vlc0000gp/T/pip-install-dpr3g5ph/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/c_/ll8fp86d39d2qthh_cbg8vlc0000gp/T/pip-record-s04b7vvw/install-record.txt --single-version-externally-managed --compile --install-headers /Users/andreamoro/.pyenv/versions/3.8.6/include/python3.8/fbprophet Check the logs for full command output.

I'm not using Anaconda or anything like it, Xcode is installed.
As far as I can understand from the above, it seems the error code is due to some writing permission, which as a matter of fact are correct because on this working laptop IT prevents me to write into the private folder.

I had a look at the settings, but couldn't spot anything that allow me to specify a different folder.

Has anybody had a similar issue?

Thanks
Andrea

@andreamoro facing the same problem as you mentioned. Please update me if you find a solution
thanks

It might me a problem with pystan, which relies on C++ libraries that are not found where expected. I'm trying to speak with a developer there. Are you able to run pyStan and a demo example with success on your end @vemuri-nath ?

Was this page helpful?
0 / 5 - 0 ratings