logger.warning("MSVC is not supported") Error when installing pystan on windows 10

8.5k views Asked by At

My goal is to install fbprophet on my windows 10 computer. I'm trying to install pystan (prophet's main dependency) using pip, but after a minute or so, i get the following error:

Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\users\User\appdata\local\temp\pip-build-nbypis\pystan\setup.py", line 124, in <module>
        logger.warning("MSVC is not supported")
    NameError: name 'logger' is not defined

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\User\appdata\local\temp\pip-build-nbypis\pystan\

I'm using python 2.7

1

There are 1 answers

1
Stefan Iancu On

Pystan needs a working C++ compiler, but MSVC is not supported as described in the docs: https://pystan2.readthedocs.io/en/latest/windows.html (edit 9/2/2021 update to pystan2 docs)

The solution is to install mingw-w64 compiler which you can do using conda which is much easier. If you want to only use vanilla python and pip, read on.

Download mingw complier from: http://mingw-w64.org/doku.php/download Please make sure that you download and install the 64 bits version as the 32 bits crashes when compiling pystan due to the memory threshold for 32 bit applications. If you install manually you need to add [...]\MinGW\bin\ folder to the PATH.

Check your distutils.cfg and add this:

[build]
compiler=mingw32

Moreover it seems that due to a bug pystan versions newer than 2.17.1 do not compile correctly under windows on a non-conda environment. So if this is an option for you, use this version.

Then FBProhpet did not like MinGW compiler installed manually so I needed to comment the the mingw compiler lines in distutils. You need to make sure you have MSVC 14 and Windows SDK installed - python recognizez these automatically, no need to change again distutils.cfg.