How can I install cython

16,806

Solution 1

Cython is now available on PyPI as pre-built binary wheel packages. On Windows and any other platform with an existing wheel, compilation is no longer necessary. You can now just do:

pip install Cython

Obsolete answer

Cython is a binary package. This means it is not written entirely in Python. Part of it is in a language that compiles to native binaries, such as C or C++. vcvarsall.bat is a Microsoft script for calling a compiler for C or C++ code. In other words, you don't have a compiler installed on your system (or at least, Python can't find it).

Your options include:

  • Install a C/C++ compiler and make sure Python can find and use it
  • Find a prebuilt binary of this library

The latter will be simpler. You can find the binary here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#cython. Download the binary that corresponds to your bitness and Python version. For example, if you're using Python 3.4 and your system is 32-bit, you would download Cython‑0.21.1.win32‑py3.4.exe. Save this to a location where you know the path. (One simple choice is just saving it to the C:\ directory.) Then run easy_install on the downloaded file, similar to this:

easy_install C:\Cython‑0.21.1.win32‑py3.4.exe

(Make sure you change the paths in that command to match the actual file paths.)

Solution 2

Sadly, installing the great kivy framework on windows can be a pain. If you are looking for a complete kivy-IDE for windows, fortunately there is a nice fork of Winpython with Kivy already included!

Winpython Kivy Flavored

Just download, unpack and start spyder and you are ready to go for kivy coding on windows. Even works with a restricted user account.

Share:
16,806
GLHF
Author by

GLHF

Updated on June 04, 2022

Comments

  • GLHF
    GLHF almost 2 years

    In the process of installing Kivy on Windows, I found that I needed Cython.

    • I tried installing it using easy_install cython, but this gave the following error: error: Unable to find vcvarsall.bat
    • I downloaded the package from Cython's official page, but when trying to run python setup.py install, I saw the same errors.

    How can I install Cython? Without this 'vcvarsall.bat' error.

    I am running Windows 32 bit.

    enter image description here

    enter image description here

  • GLHF
    GLHF over 9 years
    I still got error messages. I really want to know, why an install is so hard? They cant make an exe. file for install?
  • jpmc26
    jpmc26 over 9 years
    @qqvc Please edit the additional error messages into your question.
  • jpmc26
    jpmc26 over 9 years
    @qqvc It appears that easy_install was unable to find the Cython binary you downloaded. (That doesn't surprise me considering your current directory.) Where did you download the Cython binary? Use the full path of the binary in your command, such as C:\Cython‑0.21.1.win32‑py3.4.exe if you saved the file to C:\ .
  • GLHF
    GLHF over 9 years
    Its in python file. I open cmd in python so I dont have to add full path
  • jpmc26
    jpmc26 over 9 years
    @qqvc See how it says it's trying to access http://pypi.python.org? That means it's looking on the internet for the package. If it could find the file you saved to the computer, it wouldn't look on the Internet. Try using the full path.
  • GLHF
    GLHF over 9 years
    can you check the question again please. its my python file.and when I download Cython Its auto extracted there.
  • jpmc26
    jpmc26 over 9 years
    @qqvc Do you have pip? If not, execute easy_install pip. Then execute pip freeze. If Cython is in the list, you've successfully installed Cyhton. Don't worry about where it puts its files.
  • GLHF
    GLHF over 9 years
    ok I installed Cython with your way Im sure now. Well, last step is installing kivy, I still got vcvarsall.bat error. I tried to find it in web but couldnt..
  • GLHF
    GLHF over 9 years
    and thank you for helping me I appriciated
  • jpmc26
    jpmc26 over 9 years
    @qqvc There's a Kivy build on the same page I linked to before: lfd.uci.edu/~gohlke/pythonlibs/#kivy. Install it the same way. Note the pygame requirement. If my answer solves your problem, please consider accepting it.
  • GLHF
    GLHF over 9 years
    yes I installed pygame and kivy with same way. I think all done but now how can I open kivy lol
  • jpmc26
    jpmc26 over 9 years
    @qqvc There's probably a kivy.exe or kivy.bat in the C:\Python34\Scripts directory would be my first guess.
  • GLHF
    GLHF over 9 years
    there is only a kivy.bat in desktop, in the kivy folder. and when I double click to it a cmd screen appear. How can I work like Python on this?
  • jpmc26
    jpmc26 over 9 years
    @qqvc I know nothing about Kivy. A tutorial might help. If you look hard and try things out and still can't find any info, another question might be warranted.