Home > Fixes, Python, RDF > “Unable to find vcvarsall.bat” error when trying to install rdflib

“Unable to find vcvarsall.bat” error when trying to install rdflib

Some things just don’t work out like you expect them to do. During my quest with a new web application that I’m about to develop, the very first and basic thing went wrong. The setup of the rdflib python library (version 2.4.2) gave me the following error (on Windows):

“error: Setup script exited with error: Unable to find vcvarsall.bat”

After a lot of useless spent hours on trying to come up with some solution, the answer was found. There is a good solution on the project page of the library too, but I found a slightly quicker solution:

  1. First of all download MinGW. You need g++ compiler and MingW make in setup.
  2. If you installed MinGW for example to “C:\MinGW” then add “C:\MinGW\bin” to your PATH in Windows.
  3. Now start your Command Prompt and go the directory where you have your setup.py residing.
  4. Last and most important step:
    setup.py install build --compiler=mingw32

Note: This is all about rdflib version 2.4.2! Version 3.x for example has some major differences with 2.4.2 and so I’m not aware whether the problem there exists and even if it does, i’m not sure if it can be solved by the above solution.

If you have a similar problem but with some other module and you can’t fix it in this way, then you should try this.

Categories: Fixes, Python, RDF Tags:
  1. fallino
    June 15th, 2010 at 12:43 | #1

    Did work for me but only with double dash :
    > setup.py install build –compiler=mingw32

  2. fallino
    June 15th, 2010 at 12:46 | #2

    @fallino
    double dash wich are here interpreted as em dash, ok …. so here is the ‘copy&paste’ version
    > setup.py install build ––compiler=mingw32

  3. June 15th, 2010 at 12:50 | #3

    @fallino
    I actually did use

     '--'

    instead of the

    '-'

    in this post, but the WordPress code makes it visible as one stripe. I have put it in pre-code tag so that the double stripe is visible now. Thanks for pointing that out. :)

  4. Pedro
    July 26th, 2010 at 05:00 | #4

    This saved me a day. Thanks

  5. September 6th, 2010 at 11:51 | #5

    Thanks for the information – that helped me a lot.
    But you have to put C:\MinGW\bin to the path ;)

  6. September 6th, 2010 at 14:33 | #6

    Alex :

    Thanks for the information – that helped me a lot.
    But you have to put C:\MinGW\bin to the path ;)

    Of course. Updated the article. Thanks for the comment.

  7. Tames
    September 7th, 2010 at 22:03 | #7

    Awesome, this was driving me crazy. Thanks!

  8. tregou
    October 6th, 2010 at 10:28 | #8

    Hi there,
    I have MS Visual Studio C++ installed, I know exactly where vcvarsall.bat is located on my machine. I have added its location to PATH. I have also tried to launch the command “python C:/mypath/setup.py install” from the directory where vcvarsall.bat is.
    Either way, I still get an “unable to find vcvarsall.bat”.
    Anyone knows why???
    Thanks

  9. tregou
    October 6th, 2010 at 10:30 | #9

    @tregou
    I am trying to install PIL by the way.

  10. blue
    July 19th, 2011 at 03:18 | #10
  11. Mike
    August 22nd, 2011 at 06:40 | #11

    Thank you, that saved me a lot of work!

  12. February 18th, 2012 at 05:35 | #12

    I met following error:

    building ‘psyco._psyco’ extension
    C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DNDEBUG=1 -DALL_STATIC=1 -Ic\i3
    86 -IC:\Python27\include -IC:\Python27\PC -c c/psyco.c -o build\temp.win-amd64-2
    .7\Release\c\psyco.o
    cc1.exe: error:unrecognized command line option ‘-mno-cygwin’
    error: command ‘gcc’ failed with exit status 1

  13. Mark A.
    April 27th, 2012 at 12:54 | #13

    I got the error: ‘gcc’ failed: Permission denied. How can I change ?

  14. Mayank
    September 20th, 2012 at 21:27 | #14

    Hi. I am getting the same error as Mike and Qi, please help

    7\Release\c\psyco.o
    cc1.exe: error:unrecognized command line option ‘-mno-cygwin’
    error: command ‘gcc’ failed with exit status 1

  15. March 15th, 2013 at 09:21 | #15

    If you are getting this error ‘-mno-cygwin’ thats probably because youare using the latest gcc.

    Either install older gcc version or do this:

    goto /Libs/disutils/cygwincompiler.py and remove all the occurence of -mno-cygwin.

  16. Dan F.
    August 5th, 2013 at 13:51 | #16

    Chipmunk :
    If you are getting this error ‘-mno-cygwin’ thats probably because youare using the latest gcc.
    Either install older gcc version or do this:
    goto /Libs/disutils/cygwincompiler.py and remove all the occurence of -mno-cygwin.

    It worked! Thank you, I was trying to install fabric with pip and got the `-mno-cygwin’ error and now it’s gone :)

  1. August 10th, 2010 at 04:40 | #1
  2. June 21st, 2011 at 12:57 | #2
  3. January 15th, 2012 at 03:04 | #3
*