TypeError: unorderable types: NoneType() >= str()

If your question relates to installation please also provide the following information:

  • Windows
  • Python 3.5

I have installed PyStan following the instructions on https://pystan.readthedocs.io/en/latest/windows.html. I have also added the path variables as discussed inhttps://discourse.mc-stan.org/t/compile-error-for-pystan-on-windows/1265. However, running the test case

import pystan
model_code = ‘parameters {real y;} model {y ~ normal(0,1);}’
model = pystan.StanModel(model_code=model_code)
y = model.sampling().extract()[‘y’]
y.mean() # with luck the result will be near 0

I get below exception:

INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_5944b02c79788fa0db5b3a93728ca2bf NOW.
Traceback (most recent call last):
File “”, line 3, in
File “C:\Users\u23366\AppData\Local\Continuum\Anaconda3\envs\stan_env\lib\site-packages\pystan\model.py”, line 350, in init
build_extension.run()
File “C:\Users\u23366\AppData\Local\Continuum\Anaconda3\envs\stan_env\lib\distutils\command\build_ext.py”, line 308, in run
force=self.force)
File “C:\Users\u23366\AppData\Local\Continuum\Anaconda3\envs\stan_env\lib\distutils\ccompiler.py”, line 1031, in new_compiler
return klass(None, dry_run, force)
File “C:\Users\u23366\AppData\Local\Continuum\Anaconda3\envs\stan_env\lib\distutils\cygwinccompiler.py”, line 285, in init
CygwinCCompiler.init (self, verbose, dry_run, force)
File “C:\Users\u23366\AppData\Local\Continuum\Anaconda3\envs\stan_env\lib\distutils\cygwinccompiler.py”, line 129, in init
if self.ld_version >= “2.10.90”:
TypeError: unorderable types: NoneType() >= str()

Can anybody help?

The problem seems to relate to get_versions() in \distutils\cygwinccompiler.py" failing to find out the versions of gcc, ld and dllwrap. This turns out to be a problem when comparing the None returned to string variables in the init of class CygwinCCompiler.

image

image

Any idea how this can be handled? Why would it not be possible to determine the version?

You should probably just install the Mingw64 toolchain as in the PyStan docs. The comments on CygwinCCompiler are for ancient versions of GCC (3.2!)

Thanks a lot. I did. but maybe I simply need to update my conda and try again. I’ll let.you know.

Remember to install libpython, but it is not probably your problem.

I have had this before and my guess is that some msvc lib fails to install. See https://github.com/stan-dev/pystan/issues/472

My solution was to create a new env, first install m2w64 + libpython and then pystan.

Hi,

took some time. And it is still not resolved. I am getting the very same error message as before (see sreenshot at the bottom). I’ll try on a different machine tonight. I would appreciate any ideas, though;-)

This is what I’ve tried

  1. I have updated my Anaconda using “conda update conda”. See below for the list of packages in the 3.7 environment
  2. Follow the instructions step-by-step as described in readthedocs.io. Note that I had to use conda to install pystan because pip failed.

image

image

Then something is wrong if you can’t pip install pystan.

Can you make a new issue in github and let’s figure this out.

What does this show you?

python -c "import sys;print (sys.version)"