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

3

6
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.

Sago answered 13/2, 2018 at 10:31 Comment(0)
D
6
  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.)

Doolittle answered 28/11, 2018 at 17:59 Comment(1)
I tried this but it didn't work for me. Apparently the msc_ver of my computer is 1915 and I get the error ValueError: Unknown MS Compiler version 1915. What can I do to solve it?Interdenominational
M
3

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.

Mansized answered 19/2, 2018 at 15:54 Comment(0)
E
0

Patch cygwinccompiler.py after imports block like this:

path=r'C:\mingw\bin'
if not path in os.environ["PATH"]: os.environ["PATH"] += os.pathsep + path
Emelda answered 22/10, 2021 at 13:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.