0

I am trying to install Cython on a computer running Windows 7. I am using MinGW for my C-compiler. I've taken the following steps:

  1. Installed MinGW.

  2. Added C:\MinGW\bin to Path. Made sure Path included no empty spaces.

  3. Created the file distutils.cfg in the distutils directory. It reads:

    [build]
    compiler=mingw
    [build_ext]
    compiler=mingw
  4. I start the command prompt, got to the proper directory and type "python setup.py install". I get the following output:

    running install
    running build
    running build_py
    running build_ext
    building 'Cython.Plex.Scanners' extension
    error: Unable to find vcvarsall.bat

As far as I've understood, this is an error regarding setting MinGW as the C-compiler, but I've aldready included it into Path. What more can I do? Where do I go from here?

Saullo G. P. Castro
  • 56,802
  • 26
  • 179
  • 234
user2536262
  • 279
  • 2
  • 8
  • 22

2 Answers2

1

Open CMD and type:

SET VS90COMNTOOLS=%VS100COMNTOOLS%

Change the numbers for the edition value of Visual Studio you are running :)

Possibly stolen from here: error: Unable to find vcvarsall.bat

EDIT:

you can download the necessary packages from here:

http://go.microsoft.com/?linkid=7729279

It also sets VS90COMMNTOOLS for you :)

Community
  • 1
  • 1
  • I am using MinGW as my compiler. Am I still running som form of Visual Studio? I don't have Visual Studio installed on this computer. – user2536262 Jun 27 '14 at 11:33
  • 1
    As far I understand, Python 2.7 was compiled for Windows using Visual Studio (make sure you use the right version, as stated in the link). In order to avoid incompatible binaries (?), it is recommended to use the same compiler, namely Microsoft's cl.exe, which is bundled in Visual Studio. MinGW is not a form of VS – Wouldn't You Like To Know Jun 27 '14 at 11:46
  • Where should I enter this? – user2536262 Jun 27 '14 at 14:32
  • This worked, in the sense that it makes the installation of Cython run properly. I do however have a script that is supposed to test if cython runs properly, and it does not approve. It stops in a file called msvc9compiler.py where it gives the error "ImportError: Building module cython_test failed: ["ValueError: [u'path']\n"]". – user2536262 Jun 27 '14 at 14:58
  • I must admit that I dont know. If you succeed, please post your solution here, so that we all may profit from it. Personally, I'd just install VS2009 – Wouldn't You Like To Know Jun 27 '14 at 20:14
  • Is there any particular reason to install VS2009 and not a later version? – user2536262 Jun 30 '14 at 08:32
  • I downloaded and installed Visual Studio Express 2013. The Cython test script works now, but other scripts I'm supposed to run gives me import errors. The problem remains not entirely solved. – user2536262 Jun 30 '14 at 10:32
0

Why wont You use prebuilded packages from Here

?

I also tried compiling Cython and also failed. This way is far easier :)

Kowalski Paweł
  • 594
  • 1
  • 6
  • 27
  • This certainly seems interresting. I tried downloading Cython 0.20.2 for Python 2.7, but when I run the installation file it says Python 2.7 does not exist in the registry. It is certainly installed on the computer. Should I specify this somewhere? – user2536262 Jun 27 '14 at 09:07
  • If You've got administrative rights, You could add it to registry by Yourself. You could see how: [HERE](http://stackoverflow.com/questions/3652625/installing-setuptools-on-64-bit-windows/9131949#9131949) – Kowalski Paweł Jun 27 '14 at 09:30
  • This is the simplest answer (only since Python 3.x does the installer offer adding Python to the registry) – Wouldn't You Like To Know Jun 27 '14 at 11:54
  • I tried to do that. It didn't work. Is there any other way to check if the changes have actually been entered into the registry? – user2536262 Jun 27 '14 at 14:32
  • Yes, You can open regedit and check, if this path exist. you can also add it then by Yourself. – Kowalski Paweł Jun 28 '14 at 05:46
  • What should I look for? I'm a bit new to this. I can see that .py-files are listed at some point, but that doesn't really tell me very much. – user2536262 Jun 30 '14 at 08:46
  • You've got 32 bit or 64 bit version of Python? – Kowalski Paweł Jun 30 '14 at 12:07