13

I am trying to install fbprophet for Python using Pip install, but failing. I have already installed Pystan.

Can I import it using Anaconda Navigator?

Can someone please help.

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 C:\ProgramData\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SJ-Admin\\AppData\\Local\\Temp\\pip-build-bsm4sxla\\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 C:\Users\SJ-Admin\AppData\Local\Temp\pip-kvck8fw1-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
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\SJ-Admin\AppData\Local\Temp\pip-build-bsm4sxla\fbprophet\setup.py", line 126, in <module>
        """
      File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "C:\ProgramData\Anaconda3\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "C:\ProgramData\Anaconda3\lib\distutils\command\install.py", line 545, in run
        self.run_command('build')
      File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\ProgramData\Anaconda3\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Users\SJ-Admin\AppData\Local\Temp\pip-build-bsm4sxla\fbprophet\setup.py", line 46, in run
        build_stan_models(target_dir)
      File "C:\Users\SJ-Admin\AppData\Local\Temp\pip-build-bsm4sxla\fbprophet\setup.py", line 28, in build_stan_models
        from pystan import StanModel
    ImportError: cannot import name 'StanModel'
kaya3
  • 47,440
  • 4
  • 68
  • 97
DataScience2017
  • 171
  • 1
  • 1
  • 9

14 Answers14

20

Fundamental step: Switch to your environment in your Anaconda prompt: conda activate name-of-your-python-enviornment

Then the following steps shall work:

  1. On Prompt install Ephem:

    conda install -c anaconda ephem
    
  2. Install Pystan:

    conda install -c conda-forge pystan
    
  3. Finally install Fbprophet:

    conda install -c conda-forge fbprophet
    
  4. If exists error from holidays package

    pip install holidays==0.9.12
    

Reference: https://github.com/facebook/prophet/issues/892

Reference for Holiday package error: https://github.com/facebook/prophet/issues/1300

Chethan
  • 341
  • 2
  • 8
6

Use offline package installer: this works with Python 3.8. and Python 3.9.x

pip install localpip 
localpip install fbprophet
Alex BOURG
  • 69
  • 1
  • 1
3

I could install fbprophet using conda install -c conda-forge fbprophet. This was failing too due to permission issue My folder had 'read-only' permissions. I modified it to read-write. Then reran the command and was able to install fbprophet

DataScience2017
  • 171
  • 1
  • 1
  • 9
2

So after I did

conda install -c conda-forge fbprophet

I got at the end:

EnvironmentNotWritableError: The current user does not have write permissions to the target environment.
  environment location: C:\ProgramData\Anaconda3

ProgramData is system folder, so changed r-w permissions(took few minutes), and I also did this for C:\Program Files\Python37 path with Lib folder.

Snympi
  • 859
  • 13
  • 18
  • There is a solutions in another branch - As a solution, I re-installed Anaconda just for me and now the base environment is in \AppData\Local\Continuum\anaconda3 – Pulia Zlaya Nov 10 '19 at 00:04
  • 1
    Welcome to Stack Overflow _ I'm not sure but it looks as though your answer ends with a question? If you're not asking a question (as recognised by SO), please can you make the last sentence a bit clearer _ Thanks – inputforcolor Nov 10 '19 at 00:31
1

With the following environment

OSX: Big Sur 11.6

python: python:3.7-slim

$ pip install pystan==2.19
$ pip install fbprophet
Gwen Au
  • 859
  • 9
  • 10
1

For this stack:

  • CentOS: 7
  • Python: 3.8
  • GCC: 4.8.5
  • PyStan: 2.19.1.1
  • FbProphet: 0.7.1

You need these packages:

  • centos-release-scl devtoolset-8

Enable SCL devtoolset-8

source /opt/rh/devtoolset-8/enable
  • rh-python38-python rh-python38-python-devel
  • pip install pystan==2.19.1.1

Docker image with HTTPD MOD_WSGI and FBPROPHET...

FROM centos:7

EXPOSE 80

# Install Apache
RUN yum -y update
RUN yum -y install centos-release-scl
RUN yum -y install httpd httpd-tools rh-python38-python-mod_wsgi.x86_64 devtoolset-8-gcc devtoolset-8-gcc-c++ rh-python38-python rh-python38-python-devel

# Copy the wsgi module to Apache HTTP Server modules folder
RUN cp /opt/rh/httpd24/root/usr/lib64/httpd/modules/mod_rh-python38-wsgi.so /lib64/httpd/modules/mod_wsgi.so

ENV PATH="/opt/rh/rh-python38/root/usr/bin:/opt/rh/rh-python38/root/usr/local/bin:${PATH}"

WORKDIR /
COPY ROOT .

WORKDIR /opt/rh/rh-python38/root
RUN ./usr/bin/python3 /etc/get-pip.py

RUN chmod +x /usr/local/bin/install-fb.sh && /usr/local/bin/install-fb.sh
RUN pip install -r /etc/requirements.txt

# Start Apache
CMD ["/usr/sbin/httpd","-D","FOREGROUND"]

The script install-fb.sh contains this code:

$ cat ROOT/usr/local/bin/install-fb.sh
#!/bin/bash
source /opt/rh/devtoolset-8/enable
pip install pystan==2.19.1.1 fbprophet==0.7.1

The reason to put it in its own script is the SCL enable line, to avoid the gcc not found error.

I hope this helps, getting all these software packages running together is not a piece of cake :)

0

Docker Image: python 3.8-slim

This worked for me:

pip install pystan==2.19.1.1
pip install fbprophet
addno1
  • 89
  • 3
0

macOS Big Sur 11.5.2

python 3.7

This worked for me:

pip install pystan==2.19.1.1
sudo pip install fbprophet==0.7.1
0

FB prophet documentation recommends using conda for windows users as the easiest way for installing prophet. In my case, the following solved the problem (win10):

conda install -c conda-forge fbprophet -y
HassanSh__3571619
  • 1,859
  • 1
  • 19
  • 18
0
  1. Create a virtual environment using:

conda create --name myenv

  1. Activate the environment using:

conda activate myenv

  1. Install ephem using:

conda install -c anaconda ephem

  1. Install pystan using

conda install -c conda-forge pystan

  1. Install the fbrprophet using

conda install -c conda-forge fbprophet

  1. At the end install holidays:

pip install holidays==0.9.12

  1. If it still doesn't work try this at last:

conda install psycopg2

Antoine
  • 1,393
  • 4
  • 20
  • 26
0

The fbprophet package has been renamed to prophet. Using below command in Anaconda prompt worked for me:

pip install prophet

then you can import using below command:

from prophet import Prophet
doneforaiur
  • 1,308
  • 7
  • 14
  • 21
kavitha
  • 1
  • 1
-1

After a lot of research, I found the solution for installing fbprophet on windows 10.

Step 1: Check the kernel in jupyter. Locate the folder \jupyter\kernels\python3 and check the python exe location used by the kernel. Mine was pointing to - Programs\Python\Python37\python.exe open CMD prompt and go to above dir.

I am skipping pystan installation as I already installed pystan using pip command.

Step 2 : Download the file "Twisted-20.3.0-cp37-cp37m-win_amd64.whl" from https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted

python -m pip install /Twisted-20.3.0-cp37-cp37m-win_amd64.whl

Step 3 : pip install fbprophet

Installing collected packages: fbprophet Successfully installed fbprophet-0.6

Step 4 : python

import fbprophet

fbprophet.version

'0.6'

kbhuvi
  • 1
  • 1
-1

fbprophet has been renamed by prophet hence 1st install pip install pystan==2.19.1.1 then do python -m pip install prophet this will work! then to import do from prophet import Prophet

-3

This worked for me:

pip install prophet
pip install fbprophet
Amarpreet Singh
  • 227
  • 2
  • 11
  • 'prophet' and 'fbprophet' are the same library except different versions. fbprophet was renamed with the introduction of Prophet and it is the latest and greatest. you dont need both as they each have their own dependencies for supporting libraries such as pystan – odonnry Jan 12 '22 at 15:39
  • Yes but somehow using both commands at same time worked for me. – Amarpreet Singh Jan 13 '22 at 04:48