Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'easy_install -U cython' fails complaining about vcvarsall.bat and -mno-cygwin

Under Windows, it seems that easy_install with a C dependency isn't very easy.

Attempt 1 - vcvarsall.bat errors

I am installing cython under Windows7, with MinGw; I modified Windows7's PATH to include C:\MinGw\bin. At this point, I tried to easy_install -U cython, and got...

C:\Users\mike_pennington\Desktop\TestDrive>easy_install -U cython
Searching for cython
Reading http://pypi.python.org/simple/cython/
Reading http://www.cython.org
Reading http://cython.org
Best match: Cython 0.15.1
Downloading http://cython.org/release/Cython-0.15.1.zip
Processing Cython-0.15.1.zip
Running Cython-0.15.1\setup.py -q bdist_egg --dist-dir c:\users\mike_p~1\appdata
\local\temp\easy_install-qr1tet\Cython-0.15.1\egg-dist-tmp-556kzq
Compiling module Cython.Plex.Scanners ...
Compiling module Cython.Compiler.Scanning ...
Compiling module Cython.Compiler.Parsing ...
Compiling module Cython.Compiler.Visitor ...
Compiling module Cython.Compiler.Code ...
Compiling module Cython.Runtime.refnanny ...
warning: no files found matching 'bugs.txt' under directory 'tests'
error: Setup script exited with error: Unable to find vcvarsall.bat

C:\Users\mike_pennington\Desktop\TestDrive>

Attempt 2 - Fix vcvarsall.bat errors

Next, following the advice of a blog I found, I also tried putting this in C:\Python27\Lib\distutils\distutils.cfg to fix the vcvarsall.bat error.

[build]
compiler=mingw32

This only helps marginally...

C:\Python27\Lib\DISTUT~1>easy_install -U cython
Searching for cython
Reading http://pypi.python.org/simple/cython/
Reading http://www.cython.org
Reading http://cython.org
Best match: Cython 0.15.1
Downloading http://cython.org/release/Cython-0.15.1.zip
Processing Cython-0.15.1.zip
Running Cython-0.15.1\setup.py -q bdist_egg --dist-dir c:\users\mike_p~1\appdata
\local\temp\easy_install-kfif_o\Cython-0.15.1\egg-dist-tmp-o1tbkp
Compiling module Cython.Plex.Scanners ...
Compiling module Cython.Compiler.Scanning ...
Compiling module Cython.Compiler.Parsing ...
Compiling module Cython.Compiler.Visitor ...
Compiling module Cython.Compiler.Code ...
Compiling module Cython.Runtime.refnanny ...
warning: no files found matching 'bugs.txt' under directory 'tests'
cc1.exe: error: unrecognized command line option '-mno-cygwin'
error: Setup script exited with error: command 'gcc' failed with exit status 1

C:\Python27\Lib\DISTUT~1>

Caveat - No cygwin or precompiled binaries

I realize that I might be able to get this working under cygwin; however, I don't want cygwin dependencies on this library; I need native Windows7 output.

If possible, I would like to avoid precompiled Cython binaries because as the author says, they are "unsupported and for testing purposes only".

Question

How can I get cython to install via easy_install under Windows7 with MinGw?

like image 530
Mike Pennington Avatar asked Dec 16 '11 09:12

Mike Pennington


1 Answers

After more some googling, I found guidance that recommended removing -mno-cygwin from C:\Python27\Lib\distutils\cygwinccompiler.py because of a distutils bug.

Removing -mno-cygwin from C:\Python27\Lib\distutils\cygwinccompiler.py got cython to compile.

like image 117
Mike Pennington Avatar answered Oct 16 '22 18:10

Mike Pennington