prophet icon indicating copy to clipboard operation
prophet copied to clipboard

Can't install Fbprophet with Conda (or pip) in an Apple M1

Open jjcfrancisco opened this issue 3 years ago • 18 comments

I tried installing FBProphet via Conda in an Apple MacBook 13 M1 but I was unsuccessful (I also tried via pip). This is what I get:

fj@fj-MacBook-Pro ~ % conda install -c conda-forge fbprophet
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

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

  - fbprophet

Current channels:

  - https://conda.anaconda.org/conda-forge/osx-arm64
  - https://conda.anaconda.org/conda-forge/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.

Any thoughts or a feasible way to install it? I am game.

jjcfrancisco avatar Aug 16 '21 15:08 jjcfrancisco

Hmmm simple one to start with: can you try conda install -c conda-forge prophet? (not fbprophet)

If that doesn't work we might have to do some more digging.

tcuongd avatar Aug 17 '21 01:08 tcuongd

Same thing for me, and with conda install -c conda-forge prophet I get:

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: - 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                                                                                       

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

This is with a fresh conda env in python 3.8

adriendod avatar Aug 27 '21 12:08 adriendod

@adriendod Could you post the rest of the message? It should tell us which package versions aren't compatible

tcuongd avatar Oct 03 '21 23:10 tcuongd

Well this is weird because this is the full message! It doesn't tell us which package is causing the issue. :/

adriendod avatar Oct 04 '21 08:10 adriendod

it still doesn't install on Mac m1, like OP, I get this now :

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

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

  - prophet

Current channels:

  - https://conda.anaconda.org/conda-forge/osx-arm64
  - https://conda.anaconda.org/conda-forge/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.

It is not available in the OSX arm channel?

adriendod avatar Nov 01 '21 20:11 adriendod

Seeing the same issue. Is it possible to get an arm64 build for Apple Silicon via conda-forge? 🙏

jmsmcniff avatar Nov 07 '21 02:11 jmsmcniff

Hey, Got error for first time, while installing prophet through terminal. Installed pystan through Anaconda GUI. restarted terminal, executed:

conda install -c conda-forge prophet

and was installed successfully.

M1, Big Sur Version 11.4

jjTudu avatar Nov 13 '21 17:11 jjTudu

From trial and error, I am able to install Prophet in Python 3.8 with pip, and not able to in Python 3.9 and above. Note that the installation will be successful under Python 3.9, but forecasting will fail because it cannot locate the "cmdstan" libraries.

M1, Monterey Version 12.1

khanetor avatar Feb 02 '22 18:02 khanetor

Hello @nlhkh ,

Could you please tell me how did you install prophet with python 3.8?

octavd avatar Feb 09 '22 18:02 octavd

Hello @nlhkh ,

Could you please tell me how did you install prophet with python 3.8?

On my Macbook Pro M1, I install miniforge by

curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh"
bash Mambaforge-$(uname)-$(uname -m).sh
# Then follow the instruction to activate miniconda.

Visit https://github.com/conda-forge/miniforge for more info.

Then create a python environment

conda create -n test python=3.8

Then I install pystan and prophet with pip one at a time

pip install pystan==2.19.1.1
pip install prophet

I also tried installing in one go with success

pip install pystan==2.19.1.1 prophet
# or
pip install prophet

Prophet installation will throw out lots of errors about not having dependencies, or build failures, but that's okay. It will install those missing dependencies, and resume the build.

khanetor avatar Feb 15 '22 13:02 khanetor

Hello @nlhkh ,

Could you please tell me how did you install prophet with python 3.8?

I have macOS Monterey, v12.0.1 Prophet was successfully installed using python 3.8. It did NOT work with 3.9.6 version. I use pyenv to create virtual env. That is what I did:

pip3 install virtualenv pip3 install virtualenvwrapper brew install pyenv-virtualenv

You need these commands to have virtual env running under pyenv. Next, install python pyenv install 3.8.10

Create env called 'prophet': pyenv virtualenv 3.8.10 prophet

Activate it in your working directory: pyenv local prophet

Install 2 packages: pip install pystan==2.19.1.1 pip install prophet

It worked fine for me!

dbandurin avatar Mar 03 '22 22:03 dbandurin

Hello @nlhkh , Could you please tell me how did you install prophet with python 3.8?

I have macOS Monterey, v12.0.1 Prophet was successfully installed using python 3.8. It did NOT work with 3.9.6 version. I use pyenv to create virtual env. That is what I did:

pip3 install virtualenv pip3 install virtualenvwrapper brew install pyenv-virtualenv

You need these commands to have virtual env running under pyenv. Next, install python pyenv install 3.8.10

Create env called 'prophet': pyenv virtualenv 3.8.10 prophet

Activate it in your working directory: pyenv local prophet

Install 2 packages: pip install pystan==2.19.1.1 pip install prophet

It worked fine for me!

Same here - M1, Monterey v12.2.1, works using python 3.8.11, does not work using python 3.9.x

harrywang avatar Apr 11 '22 19:04 harrywang

This has been resolved in prophet 1.1. You can now pip install prophet directly from PyPI for Python 3.9 and 3.10

akosfurton avatar Jun 27 '22 14:06 akosfurton

pip install prophet

I followed the instructions (in a completely new conda environment) but I am still facing the same issue:

Screen Shot 2022-07-11 at 13 30 42

aabuabat avatar Jul 11 '22 10:07 aabuabat

@aabuabat you can resolve this issue by downgrading your prophet installation to prophet==1.0.

leopoldavezacenioka avatar Jul 12 '22 15:07 leopoldavezacenioka

Worked for me with following configuration:

OS: MacOS 12.4 Monterey (Apple M1 Pro; so all the Arm64 builts for compilers, used clang 12.0.0 as C++ compiler) python 3.8.13 cmdstanpy 0.9.68 (pip installed) prophet 1.0 (pip installed) pystan 2.19.1.1 (conda-forge installed)

yunis99wirkus avatar Aug 10 '22 19:08 yunis99wirkus

pystan 2.19.1.1 (conda-forge installed)

this doesnt work on these m1 since pystan fails on prophet==1.0 but not pip install prophet

asanders2022 avatar Sep 20 '22 00:09 asanders2022

I am having the same runtime issue of the missing libtbb.dylib using prophet==1.1 on MacOS 12.2.1 M1 and Python 3.10.4

I've seen elsewhere that people can get it to work using previous versions of prophet on python 3.8, but I would love to not downgrade our entire ETL stack from 3.10 to 3.8 just to run Prophet.

eliwoods avatar Sep 22 '22 00:09 eliwoods

Same issue here with Python 3.9.6, both prophet==1.0 and prophet==1.1 and MacOS 12.6. Did someone get it to work any way other than to downgrade Python ?

mikehdr avatar Oct 07 '22 14:10 mikehdr

@michaelhodara @eliwoods

I've tried using 'python=3.9.x' quite a while. The problem (as far as I could identify it) was always 'cmdpystan', when I ran it through the debugger. Worth a try: built cmdpytan and postman from source. That compiles a version for your system. If you cannot downgrade python, I fear you need to look through the package yourself. I don't see any reason why it technically shouldn't with 'python>3.8.x'.

Otherwise you can run all Prophet dependencies and tasks in a separated venv. Hope it helps a bit :)

yunis99wirkus avatar Oct 10 '22 05:10 yunis99wirkus

I successfully run the sample code @aabuabat above using prophet 1.1.1 and python3 10.6 on M2 macbook air. It firstly complains about libtbb.dylib, but I simply find /opt/homebrew/Caskroom/miniforge -name libtbb* and copy the libtbb*dylib to /opt/homebrew/Caskroom/miniforge/base/lib and restart the ipython/jupyter kernel and finally it can find the required libtbb*. Screenshot 2022-10-22 at 5 48 01 AM

Edit: I use macos ventura. The installation is simpy conda install pystan and pip install prophet

solie avatar Oct 21 '22 21:10 solie

I got prophet to work on m1 with python=3.10 by using rosetta (intel arch emulator). Here is a blog which details how you can manage two conda installations for each architecture on an m1: https://taylorreiter.github.io/2022-04-05-Managing-multiple-architecture-specific-installations-of-conda-on-apple-M1/

anton164 avatar Oct 26 '22 15:10 anton164

If you are in python3.9+ it was not supported yet. I encountered same issue when I was in python3.9+. When I tried to install a lower version. e.g. 3.7.2, now it works!

tlengUber avatar Dec 01 '22 00:12 tlengUber

python 3.8.15, pystan from conda, prophet 1.1 from pip, had an error: Symbol not found: "__ZNSt11range_errorD1Ev" had to do this to fix it: remove libtbb.12.7.dylib, libtbb.12.dylib and libtbb.dylib from ~/miniconda3/lib/, symlink the replacement from prophet package:

cd ~/miniconda3/lib
ln -s ~/miniconda3/lib/python3.8/site-packages/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib libtbb.12.7.dylib
ln -s ~/miniconda3/lib/python3.8/site-packages/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib libtbb.12.dylib
ln -s ~/miniconda3/lib/python3.8/site-packages/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib libtbb.dylib

remixer-dec avatar Dec 09 '22 20:12 remixer-dec

These two worked for me:

cp ~/miniforge3/envs/ds/lib/python3.10/site-packages/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/*.dylib ~/miniforge3/lib
sudo cp ~/miniforge3/envs/ds/lib/python3.10/site-packages/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/*.dylib /usr/local/lib/

Arunes007 avatar Feb 21 '23 13:02 Arunes007

Worked for me with the following versions:

OS: MacOS 12.4 Monterey (Apple M1 Pro) python 3.9.16 ([Clang 14.0.0 (clang-1400.0.29.202)] on darwin) cmdstanpy 0.9.68 (pip installed) prophet 1.0 (pip installed) pystan 2.19.1.1 (pip installed)

Steps to reproduce:

python3.9 -m venv env
source env/bin/activate
python3.9 -m pip install prophet==1.0
python3.9 -m pip install pystan

detrin avatar Feb 24 '23 12:02 detrin

Hi ... I'm running vanilla python 3.9.6 without conda on an M1 Mac running Ventura 13.2.1, and got it working with the latest cmdstan and prophet versions. Now downgrades needed. Here's what I did:

a) download the latest cmdstan code and build it yourself (basically "make build") b) put the files in bin into /usr/local/bin c) run export PROPHET_REPACKAGE_CMDSTAN=False pip install prophet

The last command tells prophet not to use its older hacked version of cmdstan that doesn't support the M1, but just use the version that's installed. Things seem to work great now.

willer avatar Mar 08 '23 20:03 willer

@willer's solution doing PROPHET_REPACKAGE_CMDSTAN=False worked for me on Apple M1 Pro, MacOS Ventura 13.1. I have installed prophet 1.1.2 with python 3.9.16.

I was running into the error: "CmdStan failed to install in repackaged directory". That's because of a bug in cmdstanpy (https://github.com/stan-dev/cmdstan/pull/1127) which was fixed in the latest versions of cmdstanpy. However, prophet=1.1.2 is still using an old version of cmdstanpy where this bug materializes for some Mac M1 users (CMDSTAN_VERSION = "2.26.1").

What I did: a) Create a python environment (venv or conda) and install the library cmdstanpy (simply with pip install --upgrade cmdstanpy). This library downloads CmdStan from GitHub and builds the CmdStan utilities. Read more here: https://cmdstanpy.readthedocs.io/en/v0.9.75/installation.html#install-package-cmdstanpy b) add export PROPHET_REPACKAGE_CMDSTAN=False to my terminal environment settings file (open and edit with the command: nano ~/.zshrc)
c) check if the environment variable was set with command: echo "$PROPHET_REPACKAGE_CMDSTAN" in a new terminal window, if it doesn't print False, then probably your default terminal is bash not zsh, so edit the bash profile (nano ~/.bash_profile)

nicolaivico avatar Mar 15 '23 12:03 nicolaivico

I was facing the same problem of "CmdStan failed to install in repackaged directory". and tried your solution, which resulted in ValueError: No CmdStan installation found, run command "install_cmdstan"or (re)activate your conda environment! error for me. So, I installed cmdstan (not sure why it didn't earlier) by these 2 commands:

>>> from cmdstanpy import install_cmdstan
>>> install_cmdstan()

and did install prophet, and it worked. So, summarizing the steps for the successful installation (which worked for me): My environment (MacOS Ventura 13.3.1, M1 Max) For virtualenv using pyenv:

pip3 install virtualenv
pip3 install virtualenvwrapper
brew install pyenv-virtualenv

Next, install python pyenv install 3.8.10

Create env called 'prophet': pyenv virtualenv 3.8.10 prophet

Activate it in your working directory: pyenv local prophet

Install 2 packages:

pip install pystan==2.19.1.1
pip install prophet

If you face this error: "CmdStan failed to install in repackaged directory", try doing this: export PROPHET_REPACKAGE_CMDSTAN=False

If you still face some issue like ValueError: No CmdStan installation found, run command "install_cmdstan"or (re)activate your conda environment!, do this in your python console:

>>> from cmdstanpy import install_cmdstan
>>> install_cmdstan()

And try to run this command again: pip install prophet

And it works!

ankitkulsh avatar Apr 21 '23 09:04 ankitkulsh

I got it working on my Apple M2 Pro machine!

I had to fix 1 line after install and make 3 symlinks for not loaded libraries.

See the post:

https://stackoverflow.com/a/76264243/1396899

kadirmalak avatar May 16 '23 14:05 kadirmalak