Code Sample, a copy-pastable example if possible

I followed the rules described at the docs. The only thing which differs is that I have Visual Studio 2017 installed. Of course I added Python support for it.

Problem description

I either issue the command python setup.py build_ext --inplace or the command python setup.py develop and end up with an invalid comparison

python setup.py build_ext --inplace

running build_ext
Traceback (most recent call last):
  File "setup.py", line 740, in <module>
    **setuptools_kwargs)
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\distutils\command\build_ext.py", line 308, in run
    force=self.force)
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\distutils\ccompiler.py", line 1031, in new_compiler
    return klass(None, dry_run, force)
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\distutils\cygwinccompiler.py", line 285, in __init__
    CygwinCCompiler.__init__ (self, verbose, dry_run, force)
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\distutils\cygwinccompiler.py", line 129, in __init__
    if self.ld_version >= "2.10.90":
TypeError: '>=' not supported between instances of 'NoneType' and 'str'

python setup.py develop

running develop
running egg_info
writing pandas.egg-info\PKG-INFO
writing dependency_links to pandas.egg-info\dependency_links.txt
writing requirements to pandas.egg-info\requires.txt
writing top-level names to pandas.egg-info\top_level.txt
reading manifest file 'pandas.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
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 '*.pyd' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '#*' found anywhere in distribution
warning: no previously-included files matching '.DS_Store' found anywhere in distribution
writing manifest file 'pandas.egg-info\SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File "setup.py", line 740, in <module>
    **setuptools_kwargs)
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\site-packages\setuptools\command\develop.py", line 36, in run
    self.install_for_development()
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\site-packages\setuptools\command\develop.py", line 134, in install_for_development
    self.run_command('build_ext')
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\distutils\command\build_ext.py", line 308, in run
    force=self.force)
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\distutils\ccompiler.py", line 1031, in new_compiler
    return klass(None, dry_run, force)
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\distutils\cygwinccompiler.py", line 285, in __init__
    CygwinCCompiler.__init__ (self, verbose, dry_run, force)
  File "C:\Users\MY_USER_NAME\AppData\Local\Continuum\anaconda3\envs\pandas_dev\lib\distutils\cygwinccompiler.py", line 129, in __init__
    if self.ld_version >= "2.10.90":
TypeError: '>=' not supported between instances of 'NoneType' and 'str'

Expected Output

I'd love to have a nice error message which I can work with. As I have not set up any cygwin compiler and hoped that behind the scenes Visual Studio 2017 would be chosen automatically, now it is a bit difficult to guess what the real problem is unless I step through the code.

Output of pd.show_versions()

Latest commit is d80a4b81938e3982708ccd012e983f11aa651af1

Comment From: gfyoung

@1kastner : Windows support for building from source has been tricky. I've had success with Cygwin before, though I personally have been wary of it (why install an entire Unix-like environment when you just need the tools?). I would use MinGW or the tools from the MingwPy project.

However, if you would like to further investigate the Cygwin path, you will need to trace back the error by hand to identify how self.ld_version gets hit. The stacktrace gives you a good starting point, but as someone who has struggled with this type of installation before, it's unfortunately not sufficient.

If you do decide to venture down the Cygwin path, let me know if you have any questions.

Comment From: TomAugspurger

From what I understand, you do not want to use cygwin to build C extensions, unless you built Python itself with Cygwin. SInce you're using conda, you're python was built with Visual Studio.

I'll see if I can setup a VM with windows this weekend and try to reproduce your error.

Comment From: TomAugspurger

@1kastner what changes to your environment did you make before running the python setup.py commands? Did you activate the correct settings with something like

CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64

(maybe different depending on your OS and version of visual studio)

Comment From: 1kastner

@TomAugspurger I did not make any changes. How can I find out what exactly I need to do to activate the correct settings? Your suggested command is not available. At C:\Program Files (x86)\Microsoft SDKs\Windows I have the two folders v7.0A and v10.0A but neither of them contain a file called SetEnv.cmd.

Comment From: 1kastner

@gfyoung I actually just want to make the project build so that I can run some tests. I do not want to make any experiments and try the simplest way available. I am not sure why the cygwin path was chosen for me as I did not input that wish anywhere. Is it possible that it was incorrectly chosen because I have Ubuntu subsystem installed on this machine and because of that some Un*x commands were successfully executed? Just a guess. I would be happy if I could achieve my goal quickly and without lots of additional tools.

Comment From: gfyoung

@1kastner : You have WSL on your machine? Install pandas via WSL instead. It won't be accessible from your Windows system, but if you want to painlessly build pandas from source on a Windows machine, that's probably a much better bet.

FYI, if you find that tests are segfaulting, open your ~/.bashrc and add the following line:

export KMP_AFFINITY=disabled

That should stop the segfaults.

But actually: give WSL a shot and save yourself the pain of Cygwin 😄

Comment From: 1kastner

Alright, I am setting up everything for WSL instead. Therefore, this issue is no longer relevant for me, but we can't say that the issue is actually solved.

Comment From: gfyoung

@1kastner : Sounds good. Let us know if you hit any roadbumps along the way though.

Comment From: 1kastner

@gfyoung Everything worked smoothly with WSL, now I can finally run my tests and continue to contribute!

Comment From: gfyoung

@1kastner : Glad to hear that worked out!