'Fbprophet installation error - failed building wheel for fbprophet
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'
Solution 1:[1]
Fundamental step:
Switch to your environment in your Anaconda prompt:
conda activate name-of-your-python-enviornment
Then the following steps shall work:
On Prompt install Ephem:
conda install -c anaconda ephemInstall Pystan:
conda install -c conda-forge pystanFinally install Fbprophet:
conda install -c conda-forge fbprophetIf 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
Solution 2:[2]
Use offline package installer: this works with Python 3.8. and Python 3.9.x
pip install localpip
localpip install fbprophet
Solution 3:[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
Solution 4:[4]
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.
Solution 5:[5]
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 :)
Solution 6:[6]
With the following environment
OSX: Big Sur 11.6
python: python:3.7-slim
$ pip install pystan==2.19
$ pip install fbprophet
Solution 7:[7]
Docker Image: python 3.8-slim
This worked for me:
pip install pystan==2.19.1.1
pip install fbprophet
Solution 8:[8]
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
Solution 9:[9]
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
Solution 10:[10]
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'
Solution 11:[11]
This worked for me:
pip install prophet
pip install fbprophet
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
