Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cygwincompiler TypeError: '>=' not supported between instances of 'NoneType' and 'str'

File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\distutils\mingw
  dry_run, force)
File "C:\ProgramData\Anaconda3\lib\distutils\cygwinccompiler.py", line
  if self.ld_version >= "2.10.90":
TypeError: '>=' not supported between instances of 'NoneType' and 'str'

Facing this error for a long time in my Python environment, I don't know if it's due to cygwin or not.

like image 243
Hunaidkhan Avatar asked Feb 13 '18 10:02

Hunaidkhan


2 Answers

  1. You need to add the 2 lines below to a new file called distutils.cfg to python/Lib/distils python installation. This will prevent "vcvarsall.bat" error or "Visual C++ requirement" error or NoneType error as seen in original question. (Assuming the "distutils.cfg" file did not exist)

    [build]
    compiler=mingw32.exe
    
    (Note: The ".exe" portion is very important here, and many other guidelines tend to leave this out!)
    
  2. Add patch to Python/Lib/disutils/cygwinccompiler.py. Change the get_msvcr() method, to the method seen in this file organized by myself to be python tab safe, or otherwise apply the change from the specific bug fix python page. (Note that the official page's code will yield an error if you copy it to your cygwinccompiler.py get_msvcr method, even after you remove the irrelevant plus signs, and ensure all things align. You'll need to delete the tabs, and replace them with the corresponding number of spaces.)

like image 125
Jordan Bennett Avatar answered Nov 01 '22 00:11

Jordan Bennett


It is probably because you have not added the mingw directory to your Windows PATH. The cygwinccompiler.py is trying to compare the version of your ld to a specific version, but has received None as the ld version. Check out the answer to this After installing minGW, gcc command is not recognized for how two add mingw to your windows PATH. After adding it to the path open a new cmd and try:

gcc -dumpversion
ld -v
dllwrap -version

If the commands are recognized you should be able to run cygwinccompiler.py normally.

like image 3
Eric Jensen Avatar answered Oct 31 '22 23:10

Eric Jensen