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

1

6

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

Lactation answered 8/10, 2018 at 16:48 Comment(3)
Same error, using python 3.7Tao
For Python 3.7, install first numpy and cython and then after that pystan.Lactation
numpy and cython are installed and I still get your error. I just wanted to flag to potential contributors that it is likely not specific to python 2.Tao
M
6

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.

Myocardium answered 29/7, 2020 at 11:32 Comment(1)
I had issues with this, simply installing the mingw-w64 compiler, setting up my PATH, and adding the distutils.cfg did not seem to suffice. The conda instructions mention the mingw64-toolchain and uses the libpython package to automatically configure the disutils.cfg. Unsure why I couldn't get it to work outside of conda but using conda was much easier.Jago

© 2022 - 2024 — McMap. All rights reserved.