prophet: Cannot use 'pip install fbprophet' to install prophet on windows 10 with python 3.6.0

Already installed python 3.60, pystan and Visual C++ 2015 Build Tools-win10

error message as follow after I use pip install fbprophet:

Command "d:\ProgramData\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\lwx\\AppData\\Local\\Temp\\pip-build-phg6epsq\\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\lwx\AppData\Local\Temp\pip-6ts715hu-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\lwx\AppData\Local\Temp\pip-build-phg6epsq\fbprophet\

And I tried to install from source code which I download from https://pypi.python.org/pypi/fbprophet/0.1.post1 Use python setup.py install and error message as follows:

c:\users\lwx\appdata\local\temp\tmp4z5vcu1o\anon_model_35bf14a7f93814266f16b4cf48b40a5a.hpp(368): error C2784: 'Eigen::Matrix<boost::math::tools::promote_args<RT1,RT2,float,float,float,float>::type,R,C,|_Rows==&&_Cols!=?:_Cols==&&_Rows!=?:,_Rows,_Cols> stan::math::add(const T1 &,const Eigen::Matrix<T2,R,C,|_Rows==&&_Cols!=?:_Cols==&&_Rows!=?:,_Rows,_Cols> &)': could not deduce template argument for 'const Eigen::Matrix<T2,R,C,|_Rows==&&_Cols!=?:_Cols==&&_Rows!=?:,_Rows,_Cols> &' from 'Eigen::Matrix<stan::math::var,-1,-1,0,-1,-1>' d:\ProgramData\Anaconda3\lib\site-packages\pystan\stan\lib\stan_math_2.14.0\stan/math/prim/mat/fun/add.hpp(72): note: see declaration of 'stan::math::add' c:\users\lwx\appdata\local\temp\tmp4z5vcu1o\anon_model_35bf14a7f93814266f16b4cf48b40a5a.hpp(368): error C2784: 'Eigen::Matrix<boost::math::tools::promote_args<RT1,RT2,float,float,float,float>::type,R,C,|_Rows==&&_Cols!=?:_Cols==&&_Rows!=?:,_Rows,_Cols> stan::math::add(const Eigen::Matrix<T1,R,C,|_Rows==&&_Cols!=?:_Cols==&&_Rows!=?:,_Rows,_Cols> &,const T2 &)': could not deduce template argument for 'const Eigen::Matrix<T1,R,C,|_Rows==&&_Cols!=?:_Cols==&&_Rows!=?:,_Rows,_Cols> &' from 'stan::math::var' d:\ProgramData\Anaconda3\lib\site-packages\pystan\stan\lib\stan_math_2.14.0\stan/math/prim/mat/fun/add.hpp(50): note: see declaration of 'stan::math::add' c:\users\lwx\appdata\local\temp\tmp4z5vcu1o\anon_model_35bf14a7f93814266f16b4cf48b40a5a.hpp(368): error C2784: 'Eigen::Matrix<boost::math::tools::promote_args<RT1,RT2,float,float,float,float>::type,R,C,|_Rows==&&_Cols!=?:_Cols==&&_Rows!=?:,_Rows,_Cols> stan::math::add(const Eigen::Matrix<T1,R,C,|_Rows==&&_Cols!=?:_Cols==&&_Rows!=?:,_Rows,_Cols> &,const Eigen::Matrix<T2,R,C,|_Rows==&&_Cols!=?:_Cols==&&_Rows!=?:,_Rows,_Cols> &)': could not deduce template argument for 'const Eigen::Matrix<T1,R,C,|_Rows==&&_Cols!=?:_Cols==&&_Rows!=?:,_Rows,_Cols> &' from 'stan::math::var' d:\ProgramData\Anaconda3\lib\site-packages\pystan\stan\lib\stan_math_2.14.0\stan/math/prim/mat/fun/add.hpp(27): note: see declaration of 'stan::math::add' c:\users\lwx\appdata\local\temp\tmp4z5vcu1o\anon_model_35bf14a7f93814266f16b4cf48b40a5a.hpp(368): error C2672: 'elt_multiply': no matching overloaded function found c:\users\lwx\appdata\local\temp\tmp4z5vcu1o\anon_model_35bf14a7f93814266f16b4cf48b40a5a.hpp(368): error C2672: 'stan::math::add': no matching overloaded function found c:\users\lwx\appdata\local\temp\tmp4z5vcu1o\anon_model_35bf14a7f93814266f16b4cf48b40a5a.hpp(368): error C2780: 'Eigen::Matrix<boost::math::tools::promote_args<RT1,RT2,float,float,float,float>::type,R,C,|_Rows==&&_Cols!=?:_Cols==&&_Rows!=?:,_Rows,_Cols> stan::math::add(const T1 &,const Eigen::Matrix<T2,R,C,|_Rows==&&_Cols!=?:_Cols==&&_Rows!=?:,_Rows,_Cols> &)': expects 2 arguments - 1 provided d:\ProgramData\Anaconda3\lib\site-packages\pystan\stan\lib\stan_math_2.14.0\stan/math/prim/mat/fun/add.hpp(72): note: see declaration of 'stan::math::add' c:\users\lwx\appdata\local\temp\tmp4z5vcu1o\anon_model_35bf14a7f93814266f16b4cf48b40a5a.hpp(368): error C2780: 'Eigen::Matrix<boost::math::tools::promote_args<RT1,RT2,float,float,float,float>::type,R,C,|_Rows==&&_Cols!=?:_Cols==&&_Rows!=?:,_Rows,_Cols> stan::math::add(const Eigen::Matrix<T1,R,C,|_Rows==&&_Cols!=?:_Cols==&&_Rows!=?:,_Rows,_Cols> &,const T2 &)': expects 2 arguments - 1 provided d:\ProgramData\Anaconda3\lib\site-packages\pystan\stan\lib\stan_math_2.14.0\stan/math/prim/mat/fun/add.hpp(50): note: see declaration of 'stan::math::add' c:\users\lwx\appdata\local\temp\tmp4z5vcu1o\anon_model_35bf14a7f93814266f16b4cf48b40a5a.hpp(368): error C2780: 'Eigen::Matrix<boost::math::tools::promote_args<RT1,RT2,float,float,float,float>::type,R,C,|_Rows==&&_Cols!=?:_Cols==&&_Rows!=?:,_Rows,_Cols> stan::math::add(const Eigen::Matrix<T1,R,C,|_Rows==&&_Cols!=?:_Cols==&&_Rows!=?:,_Rows,_Cols> &,const Eigen::Matrix<T2,R,C,|_Rows==&&_Cols!=?:_Cols==&&_Rows!=?:,_Rows,_Cols> &)': expects 2 arguments - 1 provided d:\ProgramData\Anaconda3\lib\site-packages\pystan\stan\lib\stan_math_2.14.0\stan/math/prim/mat/fun/add.hpp(27): note: see declaration of 'stan::math::add' c:\users\lwx\appdata\local\temp\tmp4z5vcu1o\anon_model_35bf14a7f93814266f16b4cf48b40a5a.hpp(368): error C2672: 'normal_log': no matching overloaded function found c:\users\lwx\appdata\local\temp\tmp4z5vcu1o\anon_model_35bf14a7f93814266f16b4cf48b40a5a.hpp(368): error C2974: 'stan::math::normal_log': invalid template argument for 'T_y', type expected d:\ProgramData\Anaconda3\lib\site-packages\pystan\stan\lib\stan_math_2.14.0\stan/math/prim/scal/prob/normal_log.hpp(120): note: see declaration of 'stan::math::normal_log' c:\users\lwx\appdata\local\temp\tmp4z5vcu1o\anon_model_35bf14a7f93814266f16b4cf48b40a5a.hpp(368): error C2780: 'return_type<T_y,T_loc,T_scale,double,double,double>::type stan::math::normal_log(const T_y &,const T_loc &,const T_scale &)': expects 3 arguments - 2 provided d:\ProgramData\Anaconda3\lib\site-packages\pystan\stan\lib\stan_math_2.14.0\stan/math/prim/scal/prob/normal_log.hpp(44): note: see declaration of 'stan::math::normal_log' c:\users\lwx\appdata\local\temp\tmp4z5vcu1o\anon_model_35bf14a7f93814266f16b4cf48b40a5a.hpp(368): error C2672: 'stan::math::accumulator<T__>::add': no matching overloaded function found with [ T__=stan::math::var ] error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 53 (19 by maintainers)

Most upvoted comments

I also can not use ‘pip install fbprophet’ to install prophet on windows 10 with python 2.7.0 of Anaconda2-4.3.0.1-Windows-x86_64.

Collecting fbprophet
  Downloading fbprophet-0.1.post1.tar.gz
    Complete output from command python setup.py egg_info:
    no previously-included directories found matching 'doc\_build'
    warning: no previously-included files matching '*.so' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '.git*' found anywhere in distribution
    warning: no previously-included files matching '*.png' found anywhere in distribution
    no previously-included directories found matching 'pystan\stan\make'
    no previously-included directories found matching 'pystan\stan\src\docs'
    no previously-included directories found matching 'pystan\stan\src\doxygen'
    no previously-included directories found matching 'pystan\stan\src\python'
    no previously-included directories found matching 'pystan\stan\src\test'
    no previously-included directories found matching 'pystan\stan\lib\stan_math\doxygen'
    no previously-included directories found matching 'pystan\stan\lib\stan_math\make'
    no previously-included directories found matching 'pystan\stan\lib\stan_math\test'
    no previously-included directories found matching 'pystan\stan\lib\stan_math\lib\cpplint_4.45'
    no previously-included directories found matching 'pystan\stan\lib\stan_math\lib\gtest_1.7.0'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\users\xiemei~1\appdata\local\temp\pip-build-smdjae\fbprophet\setup.py", line 96, in <module>
        """
      File "D:\Anaconda2\lib\distutils\core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "D:\Anaconda2\lib\site-packages\setuptools-27.2.0-py2.7.egg\setuptools\dist.py", line 315, in __init__
      File "D:\Anaconda2\lib\site-packages\setuptools-27.2.0-py2.7.egg\setuptools\dist.py", line 361, in fetch_build_eggs
      File "D:\Anaconda2\lib\site-packages\setuptools-27.2.0-py2.7.egg\pkg_resources\__init__.py", line 851, in resolve
      File "D:\Anaconda2\lib\site-packages\setuptools-27.2.0-py2.7.egg\pkg_resources\__init__.py", line 1123, in best_match
      File "D:\Anaconda2\lib\site-packages\setuptools-27.2.0-py2.7.egg\pkg_resources\__init__.py", line 1135, in obtain
      File "D:\Anaconda2\lib\site-packages\setuptools-27.2.0-py2.7.egg\setuptools\dist.py", line 428, in fetch_build_egg
      File "D:\Anaconda2\lib\site-packages\setuptools-27.2.0-py2.7.egg\setuptools\command\easy_install.py", line 664, in easy_install
      File "D:\Anaconda2\lib\site-packages\setuptools-27.2.0-py2.7.egg\setuptools\command\easy_install.py", line 694, in install_item
      File "D:\Anaconda2\lib\site-packages\setuptools-27.2.0-py2.7.egg\setuptools\command\easy_install.py", line 875, in install_eggs
      File "D:\Anaconda2\lib\site-packages\setuptools-27.2.0-py2.7.egg\setuptools\command\easy_install.py", line 1114, in build_and_install
      File "D:\Anaconda2\lib\site-packages\setuptools-27.2.0-py2.7.egg\setuptools\command\easy_install.py", line 1102, in run_setup
    distutils.errors.DistutilsError: Setup script exited with error: SandboxViolation: open('build\\lib.win-amd64-2.7\\pystan\\stan\\lib\\stan_math_2.14.0\\doc\\api\\html\\d0\\d0f\\structstan_1_1is__vector__like_3_01_eigen_1_1_matrix_3_01_t_00_01_eigen_1_1_dynamic_00_01_eigen_1_1_dynamic_01_4_01_4-members.html', 'wb') {}

    The package setup script has attempted to modify files on your system
    that are not within the EasyInstall build area, and has been aborted.

    This package cannot be safely installed by EasyInstall, and may not
    support alternate installation locations even if you run its setup
    script by hand.  Please inform the package's author and the EasyInstall
    maintainers to find out if a fix or workaround is available.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\xiemei~1\appdata\local\temp\pip-build-smdjae\fbprophet\

FYI, latest release is available via conda too: conda install -c conda-forge fbprophet

Wow same issue still present nearly 3 years later. fbprophet will not install whether pystan is installed correctly or not. i can import pystan and run a simple model, but fbprophet will not go through even when manual installed

Yes installation on Windows is a known problem. Are you able to install the pystan package? We think it’s an upstream pystan problem.

@monkeydust try this:

There seem to be two separate issues.

(1) Sometimes the PyStan installation is failing. @ritviksahajpal reported that pip install pystan did not work, but installing from source did. You should use the following code to check if PyStan is working:

import pystan
model_code = 'parameters {real y;} model {y ~ normal(0,1);}'
model = pystan.StanModel(model_code=model_code)  # this will take a minute
y = model.sampling(n_jobs=1).extract()['y']
y.mean()  # should be close to 0

If pip install pystan doesn’t work, then I’d suggest opening an issue with PyStan so they can be aware of the issue and possibly find a solution (https://github.com/stan-dev/pystan/issues).

(2) Once you do have a functioning PyStan installation, Prophet will not install. The issue here seems to be that PyStan in windows does not support matrix multiplication. @rjtavares reports that the following test case errors even with a functioning PyStan install:

import pystan
model_code = """
data {
  int n;                                
  int m;                                
  matrix[n, m] A;
  vector[n] y;
}

parameters {
  vector[m] delta;
}

model {y ~ normal(A * delta,1);}
"""
model = pystan.StanModel(model_code=model_code)

If this is the issue, then it is an upstream issue with PyStan-in-Windows and Prophet will not work until it is fixed. An issue needs to be raised with PyStan (https://github.com/stan-dev/pystan/issues). I do not currently have access to a Windows machine to run these test cases myself, and so can’t open the issue myself. If someone who has the code in (1) functioning but (2) not is willing to open an issue with PyStan that would be extremely helpful.

I had the same issue on Linux with Python 3.6.

Installing pystan manually fixed the issue (otherwise it would just hang forever).

~/GitHub % git clone https://github.com/facebookincubator/prophet
Cloning into 'prophet'...
remote: Counting objects: 358, done.
remote: Compressing objects: 100% (109/109), done.
remote: Total 358 (delta 46), reused 0 (delta 0), pack-reused 245
Receiving objects: 100% (358/358), 6.28 MiB | 3.87 MiB/s, done.
Resolving deltas: 100% (67/67), done.
~/GitHub % cd prophet/python/
~/G/p/python % pip install -e .
Obtaining file:///home/user/GitHub/prophet/python
^COperation cancelled by user
~/G/p/python % pip install pystan
Collecting pystan
  Downloading pystan-2.14.0.0-cp36-cp36m-manylinux1_x86_64.whl (62.2MB)
    100% |████████████████████████████████| 62.2MB 29kB/s 
Requirement already satisfied: numpy>=1.7 in /home/user/anaconda3/lib/python3.6/site-packages (from pystan)
Requirement already satisfied: Cython!=0.25.1,>=0.22 in /home/user/anaconda3/lib/python3.6/site-packages (from pystan)
Installing collected packages: pystan
Successfully installed pystan-2.14.0.0
~/G/p/python % pip install -e .
Obtaining file:///home/user/GitHub/prophet/python
Requirement already satisfied: matplotlib in /home/user/anaconda3/lib/python3.6/site-packages (from fbprophet==0.1.post1)
Requirement already satisfied: numpy in /home/user/anaconda3/lib/python3.6/site-packages (from fbprophet==0.1.post1)
Requirement already satisfied: pandas in /home/user/anaconda3/lib/python3.6/site-packages (from fbprophet==0.1.post1)
Requirement already satisfied: pystan>=2.8 in /home/user/anaconda3/lib/python3.6/site-packages (from fbprophet==0.1.post1)
Requirement already satisfied: six>=1.10 in /home/user/anaconda3/lib/python3.6/site-packages (from matplotlib->fbprophet==0.1.post1)
Requirement already satisfied: python-dateutil in /home/user/anaconda3/lib/python3.6/site-packages (from matplotlib->fbprophet==0.1.post1)
Requirement already satisfied: pytz in /home/user/anaconda3/lib/python3.6/site-packages (from matplotlib->fbprophet==0.1.post1)
Requirement already satisfied: cycler>=0.10 in /home/user/anaconda3/lib/python3.6/site-packages (from matplotlib->fbprophet==0.1.post1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 in /home/user/anaconda3/lib/python3.6/site-packages (from matplotlib->fbprophet==0.1.post1)
Requirement already satisfied: Cython!=0.25.1,>=0.22 in /home/user/anaconda3/lib/python3.6/site-packages (from pystan>=2.8->fbprophet==0.1.post1)
Installing collected packages: fbprophet
  Running setup.py develop for fbprophet
Successfully installed fbprophet
~/G/p/python % 

I’ll get a Windows machine and try to replicate soon. Another thing to test if you have pystan installed is compiling one of the models in the package:

import pystan
sm = pystan.StanModel(model_code=open('stan/prophet_linear_growth.stan').read())

Hi, fbprophet cannot be compiled with windows default compiler msvc. In my case, I use anaconda and try to install prophet in a conda environment. I install mingw-64 as the compiler for pystan and prophet using “conda install libpython m2w64-toolchain -c msys2”, solved the issue