Prophet / fbprophet package in Python - python

Can someone explain how to install Prophet on Python3?
I tried pip install fbprophet but it did not work.
Tried to do this in the notebook after importing pandas and sklearn and got another error:
import pandas as pd
import sklearn as sk
from fbprophet import Prophet
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-f503e9c6cf11> in <module>()
----> 1 from fbprophet import Prophet
ModuleNotFoundError: No module named 'fbprophet'

First you have to Install c++ compiler, you can install c++ compiler with below command -
conda install libpython m2w64-toolchain -c msys2
Once c++ compiler installed you have to install pystan, to install pystan you can use below command
pip install pystan
Finally, now we are ready to install facebook prophet -
pip install fbprophet
Hope this is helpful..
For more details follow this link -
https://facebook.github.io/prophet/docs/installation.html

Easiest way is to install fbprophet :
conda install -c conda-forge fbprophet
This will download all the needed packages first.
Then ->
conda install -c conda-forge/label/cf201901 fbprophet

Try installing fbprophet
pip install fbprophet
Or
pip3 install fbprophet

I had relatively similar problem, but my error was it couldn't import pystan which in installed using pip install pystan. so the problem was fbprophet doesn't support latest version of pystan so uninstall previous one and install older version of pystan.
pip install pystan==2.19.1.1
pip install fbprophet
https://facebook.github.io/prophet/docs/installation.html

On Windows it's easier using anaconda or miniconda, just give
conda install pystan
and it will install all the needed dependencies, included the c++ compiler, then
pip install fbprophet
in Linux systems, for example, ubuntu, a simple
pip install pystan
pip install fbprophet
should work, without installing anaconda/miniconda

!pip install pystan==2.19.1.1 fbprophet ##### i was trying to install fbprophet==0.7.1 but in the presence of cmdstanpy==0.9.5 it was unable to build the wheel for fbprophet.
after executing the above command for installing pystan==2.19.1.1 collectively with fbprophet successfully installed cmdstanpy-0.9.5 fbprophet-0.7.1 note that there is no version specified for fbprophet in the command and pystan is specified with version 2.19.1.1 to avoid dependency conflicts.

This worked for me. pip3 was a must!
pip3 install pystan
pip3 install fbprophet

Related

Prophet cannot be imported on Mac Miniconda

Hellow, everyone.
I want to try prophet on Mac and Miniconda environment.
I trieted below, but did not work.
try1. conda install
$ conda install gcc pystan fbprophet
try2. pip install
$ pip install fbprophet
I uninstalled and reinstalled, but result is the same.
Miniconda cannot use prophet ?
This error was solved.
Module name is changed to prophet from fbprophet in official.
My set up instruction is below.
$ pip install prophet
from prophet import Prophet
I wish this helps someone.
Thank you every one.

How do I solve "incompatible numba" error while installing Scanpy?

I tried installing the Scanpy package on Jupyter with "pip install Scanpy" but I got the the errors below;
ERROR: pynndescent 0.5.2 has requirement numba>=0.51.2, but you'll have numba 0.48.0 which is incompatible. ERROR: umap-learn 0.5.1 has requirement numba>=0.49, but you'll have numba 0.48.0 which is incompatible
When I tried to separately install an upgraded version of numba, I got the error below;
ERROR: Cannot uninstall 'llvmlite'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Run pip install --upgrade numba
Run pip install scanpy
you can try install with pip install -c numba numba=0.51.2.1rc1 if it doesn't work for you alternativly install RUN pip install llvmlite --ignore installed before pip install numba.
HAVE A GOOD DAY:)

Error when importing HMM package (hmmlearn)

When I try to import the hmmlearn package with import hmmlearn, I get this error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-9-036832e0c673> in <module>
----> 1 import hmmlearn
~\Anaconda3\envs\py385\lib\site-packages\hmmlearn\__init__.py in <module>
9 try:
10 import setuptools_scm
---> 11 __version__ = setuptools_scm.get_version( # xref setup.py
12 root="../..", relative_to=__file__,
13 version_scheme="post-release", local_scheme="node-and-date")
AttributeError: module 'setuptools_scm' has no attribute 'get_version'
I'm in a python 3.8.5 env on a windows machine. In other environments on this machine (e.g. py 3.7) I don't get the error. Also on my MacOs machine in an 3.8.5 env I can import the package without any problems. In all cases I used pip install hmmlearn to get the package.
I uninstalled and re-installed the hmmlearn and the setuptools_scm package, but that didn't fix it.
It seems like the is a problem with my setuptools_scm package. How can this be fixed? Is there a way to completely remove the hmm package and all its dependencies and do a "clean" re-install?
I had the same problem on Windows and python 3.8.5. For me, uninstalling the hmmlearn and setuptools_scm and then reinstalling it with conda (I'm in a conda environment) fixed it.
So I did:
pip uninstall hmmlearn
pip uninstall setuptools_scm
and then
conda install -c conda-forge setuptools_scm
conda install -c conda-forge hmmlearn
Also, I restarted the kernel in jupyter notebook.
But I'm not sure if that was really the problem, since I can't recreate the problem by uninstalling it over conda and reinstalling the packages over pip.
For me the solution was
pip uninstall hmmlearn
pip uninstall setuptools_scm
and then simply,
pip install hmmlearn
pip install setuptools_scm
and Kernel restart.
System setup:
Windows 10 Pro
Python 3.7.4 on conda 4.11.0

How to fix the xgboost import error in MacOs?

I had the xgboost library installed on my mac, but suddenly I get the python error: ModuleNotFoundError: No module named 'xgboost'
That's what I executed:
pip install xgboost
conda install xgboost
pip3 install xgboost
sudo pip3 install xgboost
However, I always get the following error:
Could you give me a hand?
Thank you very much
If you have package manager Anaconda use:
conda install -c conda-forge xgboost
Or:
$ brew install gcc#5
$ pip install xgboost
If it's already installed, try:
pip install --upgrade setuptools
Or:
python -m pip install --upgrade pip
pip install xgboost
Or:
If you were using pip, try to use pip3 or pip2
pip2 install xgboost
pip3 install xgboost
Here is your issue:
https://github.com/dmlc/xgboost/issues/3194
Briefly:
Download gboost from:
https://github.com/dmlc/xgboost/files/1851733/xgboost-0.7.post5.tar.gz
then run:
pip3 install xgboost-0.7.post5.tar.gz
I wasn't able to get any version of XGBoost to work on my Mac even with the above, so I wanted to share that it works on an AWS EC2 Linux instance (https://aws.amazon.com/).

Installing fbprophet Python on Windows 10

My build keeps failing on windows 10 for installing fbprophet in anaconda with the following message:
ERROR conda.core.link:_execute(502): An error occurred while installing package 'conda-forge::automat-0.7.0-py_1'.
CondaError: Cannot link a source that does not exist. C:\Users\bharat.c.ruparel\AppData\Local\Continuum\anaconda3\Scripts\conda.exe
the command that is given is:
conda install -c conda-forge fbprophet
Has anyone successfully installed fbprophet on Windows 10? If yes, then please give the steps.
Thanks.
I tried pip install as well but no luck. I have a Mac and managed to install fbprophet on it without any issues.
First install Anaconda or miniconda in your Windows machine and add conda python path to env variable as default python.
Open your command prompt and run following commands.
Create a conda virtual environment (optional)
conda create -n v-env python=3.7
activate v-env
Install c++ complier
conda install libpython m2w64-toolchain -c msys2
libpython will automatically create and setup distutils.cfg file for you in PYTHONPATH\Lib\distutils, but if that is failed use the following instructions to setup it manually
[OPTIONAL]
create distutils.cfg with text editor (e.g. notepad, notepad++) and add the following lines to that file.
[build]
compiler=mingw32
Install dependencies
conda install numpy cython -c conda-forge
conda install matplotlib scipy pandas -c conda-forge
Install PyStan
pip install pystan
or
conda install pystan -c conda-forge
Install Ephem
conda install -c anaconda ephem
Install fbprophet
pip install fbprophet
or
conda install -c conda-forge fbprophet
I also faced installing facebook prophet issue in windows 10 without conda.
But,we can solve it.
First, uninstall any pystan, fbprophet.
Then follow the steps below,
python.exe -m pip install pystan==2.17.1.0
python.exe -m pip install fbprophet==0.6
python.exe -m pip install --upgrade fbprophet
Thanks,
tsj
Updated: 28 July 2022
As of v1.0, the package name on PyPI is "prophet"; prior to v1.0 it was "fbprophet". fbprophet is now just prophet. A few additional considerations:
From v0.6 onwards, Python 2 is no longer supported.
As of v1.1, the minimum supported Python version is 3.7.
Below one will find how to
Install with PyPI
Install with Anaconda
Install the Development version
1. Istallation in Python using PyPI
Prophet is on PyPI, so one can use pip to install it.
python -m pip install prophet
2. Installation in Python using Anaconda
One might have to access Anaconda Prompt for the environment that one is working with as admin:
And run
conda-forge: conda install -c conda-forge prophet
Or
conda install -c conda-forge prophet -y
3. Development version
To get the latest code changes as they are merged, one can clone this repo and build from source manually. This is not guaranteed to be stable.
git clone https://github.com/facebook/prophet.git
cd prophet/python
python -m pip install -r requirements.txt
python setup.py develop
By default, Prophet will use a fixed version of cmdstan (downloading and installing it if necessary) to compile the model executables. If this is undesired and one would like to use one's existing cmdstan installation, one can set the environment variable PROPHET_REPACKAGE_CMDSTAN to False:
export PROPHET_REPACKAGE_CMDSTAN=False;
Sources
https://facebook.github.io/prophet/docs/installation.html
https://github.com/facebook/prophet
I've had the same problem. But it works after I follow this steps:
On Prompt install Ephem:
conda install -c anaconda ephem
Install Pystan:
conda install -c conda-forge pystan
Finally install Fbprophet
conda install -c conda-forge fbprophet
Latest installation code for 2021:
pip install pystan==2.19.1.1, then pip install prophet
Also, reboot your jupyter notebook after installation
Install without Conda, Win 10, Python 3.8.8 64 bit.
pip3 install Cython
Then install:
Reboot your maching
Install
pip3 install pystan==2.17.1.0
pip3 install fbprophet
Here's my solution. I have not use conda-forge before, so reading up on this article helps.
Making sure that conda is ≥4.9
conda --version
add conda forge channel
conda config --add channels conda-forge
conda --set channel_priority strict
install gcc
conda install gcc
install prophet
conda install -c conda-forge prophet
I used the prophet documentation here
I faced the same issue and my solution was to:-
Create a new environment with Python3.5
conda create -n pht python=3.5 anaconda
Install Prophet using the command.
conda install -c conda-forge fbprophet
I didn't install 'gcc' although this was advised before installing Prophet.
I am using Python 3.8.5 and conda 4.10.1 on a Windows 10 machine.
I was able to install prophet in Anaconda 2.0.1 using command prompt (not as admin), using: conda install -c conda-forge fbprophet
It took some time for it to figure out the details, as you can see from the prompts below, but finally it was able to install the package.
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: done

Categories

Resources