2

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
  • 3,835
  • 10
  • 38
  • 83
  • To install binary packages with `pip` or `easy_install`, you need a compiler that they can find. On Windows, it's usually easier to find and install prebuilt binaries, like [these](http://www.lfd.uci.edu/~gohlke/pythonlibs/#cython). – jpmc26 Dec 04 '14 at 00:45
  • @jpmc26 I still got "error: Unable to find vcvarsall.bat when I try to install Kivy – GLHF Dec 04 '14 at 00:55
  • @jpmc26 cant I reject your edit? It is really not what I want to write. I know how to install Cython. – GLHF Dec 04 '14 at 01:02
  • Either you don't know how to install Cython, or you're missing details from your question. I edited your question because the quality was extremely low, and I have tried very, very hard to preserve all the details you emphasized. If you feel very strongly about reversing my edit, then that is your choice, but I suspect your question will be closed if you do. Please consider editing in additional details if I've missed some instead of undoing the edit entirely. I've expanded on my comment in an answer. If you have addition problems, please edit them into the question. – jpmc26 Dec 04 '14 at 01:05

2 Answers2

10

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

jpmc26
  • 28,463
  • 14
  • 94
  • 146
  • I still got error messages. I really want to know, why an install is so hard? They cant make an exe. file for install? – GLHF Dec 04 '14 at 01:20
  • @qqvc Please edit the additional error messages into your question. – jpmc26 Dec 04 '14 at 01:21
  • @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:\ `. – jpmc26 Dec 04 '14 at 01:22
  • Its in python file. I open cmd in python so I dont have to add full path – GLHF Dec 04 '14 at 01:24
  • @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. – jpmc26 Dec 04 '14 at 01:25
  • can you check the question again please. its my python file.and when I download Cython Its auto extracted there. – GLHF Dec 04 '14 at 01:32
  • @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. – jpmc26 Dec 04 '14 at 01:35
  • 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 Dec 04 '14 at 01:37
  • and thank you for helping me I appriciated – GLHF Dec 04 '14 at 01:38
  • 1
    @qqvc There's a Kivy build on the same page I linked to before: http://www.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. – jpmc26 Dec 04 '14 at 01:39
  • yes I installed pygame and kivy with same way. I think all done but now how can I open kivy lol – GLHF Dec 04 '14 at 01:44
  • @qqvc There's probably a kivy.exe or kivy.bat in the C:\Python34\Scripts directory would be my first guess. – jpmc26 Dec 04 '14 at 01:47
  • 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? – GLHF Dec 04 '14 at 01:49
  • @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. – jpmc26 Dec 04 '14 at 01:51
1

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.

barrios
  • 1,104
  • 1
  • 12
  • 21