user2834165
user2834165

Reputation: 393

Cython Installation error

Error when running easy_install Cython:

C:\Users\Hp>cd C:\Python27\Scripts

C:\Python27\Scripts>easy_install Cython
Searching for Cython
Reading http://pypi.python.org/simple/Cython/
Best match: Cython 0.19.1
Downloading https://pypi.python.org/packages/source/C/Cython/Cython-0.19.1.zip
d5=991e7887140b3e962ef65e9c05a8694d
Processing Cython-0.19.1.zip
Running Cython-0.19.1\setup.py -q bdist_egg --dist-dir c:\users\hp\appdata\loc
\temp\easy_install-jfquni\Cython-0.19.1\egg-dist-tmp-yxdubl
Compiling module Cython.Plex.Scanners ...
Compiling module Cython.Plex.Actions ...
Compiling module Cython.Compiler.Lexicon ...
Compiling module Cython.Compiler.Scanning ...
Compiling module Cython.Compiler.Parsing ...
Compiling module Cython.Compiler.Visitor ...
Compiling module Cython.Compiler.FlowControl ...
Compiling module Cython.Compiler.Code ...
Compiling module Cython.Runtime.refnanny ...
warning: no files found matching '*.pyx' under directory 'Cython\Debugger\Test

warning: no files found matching '*.pxd' under directory 'Cython\Debugger\Test

warning: no files found matching '*.h' under directory 'Cython\Debugger\Tests'
warning: no files found matching '*.pxd' under directory 'Cython\Utility'
error: Setup script exited with error: Unable to find vcvarsall.bat

I get this error and apparently some dev file is required im not sure how to get it for windows?

Upvotes: 3

Views: 9171

Answers (2)

Max Yaffe
Max Yaffe

Reputation: 1358

My virus checker just marked refnanny.pyd as a virus and blew it away. Evidently it triggers some sort of heuristic match.

Upvotes: 0

chuseuiti
chuseuiti

Reputation: 813

I was having the same problem with vcvarsall.bat, and my steps to fix this problem for windows 8 and Python 3.4 were:

Regarding the installation of Cython there are two options: to start from this first step or to jump directly to the second one:

First step

Install Cython without using pip:

I downloaded the .whl for my version from here:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#cython

and then I installed the .whl doing:

pip install filename.whl

This way, cython is not going to complaint about vcvarshall.bat

Now you will have Cython installed, thanks to this you will be able to create c code but it will give problems with the creation of the .pyd and as soon as you start compiling the code, it will show the same error as before vcvarshall.bat is missing. That is why it is needed the second step.

Second step

  1. Install MinGW

  2. Go to C:\Python34\Lib\distutils\

    Create the file distutils.cfg and write:

    [build]
    compiler = mingw32
    
  3. Add to your path C:\MinGW\bin

  4. Now you can reinstall the .whl or directly install Cython from: pip install cython

It may still give you an error whenever you try to call to cython:

   zlib1.dll was not found
  1. Just download it from here:

    http://sourceforge.net/projects/libpng/files/zlib/1.2.3/zlib123-dll.zip/download?use_mirror=iweb&download=

  2. Extract the folder and copy-paste the zlib1.dll into C:\MinGW\bin

Now Cython should work without problems.

Also I read in some post recommendations saying that the solution is to install MVS 2008, but it is deprecated so I don't recommend this option.

This solution is a combination of multiple answers that I found and I tried until I got my correct solution, I attached the link in case you want to take a look to other solutions or points of view:

https://stackoverflow.com/a/16980330/1715716

How can I install cython

Cannot find vcvarsall.bat when running a Python script

Upvotes: 2

Related Questions