error: Unable to fin
|
I'm trying to install dulwich for bzr-git.
now, I use Python 2.6 based bazaar.
(I use msys.)
My steps are as follows:
$ bzr branch lp:dulwich
$ cd dulwich/
$ python setup.py install
running install
running build
running build_py
creating build
:
:
creating build\lib.win32-2.6\dulwich\tests
:
:
running build_ext
building 'dulwich._objects' extension
error: Unable to find vcvarsall.bat
If you know any hints, tell me please.
|
|
asked May 12 '10 at 10:24
|
|
|
add comment
|
|
For Windows installations:
While running setup.py for package installations Python 2.7 searches for an installed Visual Studio 2008. You can trick Python to use a newer Visual Studio by setting the correct path in VS90COMNTOOLS environment variable before calling setup.py .
If you have Visual Studio 2010 installed, execute
SET VS90COMNTOOLS=%VS100COMNTOOLS%
or with Visual Studio 2012 installed (Visual Studio Version 11)
SET VS90COMNTOOLS=%VS110COMNTOOLS%
or with Visual Studio 2013 installed (Visual Studio Version 12)
SET VS90COMNTOOLS=%VS120COMNTOOLS%
|
|
answered May 11 '12 at 20:39
|
|
|
|
|
|
@Gili: It looks like this problem is due to spaces in the variable, try wrapping it within quotes. For me %VS100COMNTOOLS%="C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools"
–
legends2k
Oct 5 '12 at 11:44
|
|
|
|
WARNING!!! This is WRONG answer. You should not under any circumstances compile Python C extension using different (version of) compiler that the one used to compile Python itself as those two (versions of) compilers will probably have incompatible C runtime libraries. See this answer for more details.
–
Piotr Dobrogost
Apr 29 '13 at 19:35
|
|
|
show 8 more comments
|
|
I found the solution.
I had the exact same problem, and error, installing 'amara'. I had mingw32 installed, but distutils needed to be configured.
- I have Python 2.6 that was already installed.
- I installed mingw32 to
C:\programs\mingw\
- Add mingw32's bin directory to your environment variable: append
c:\programs\MinGW\bin; to the PATH
Edit (create if not existing) distutils.cfg file located at C:\Python26\Lib\distutils\distutils.cfg to be:
[build]
compiler=mingw32
Now run easy_install.exe amara .
Make sure environment is set by opening a new cmd.exe .
|
|
answered May 15 '10 at 3:37
|
|
|
|
|
|
This works great for Python2.6, but for some reason I can't get it to work on Python2.7. It works if I downloading my package source and install using 'python setup.py install --compile=mingw32', but for some reason using easy_install or pip still tries to find vcvarsall.
–
Jonathan Hartley
Jul 16 '10 at 16:11
|
|
I finally got scikits.image to install in Python(x,y) 2.7 by adding C:\msysgit\mingw\mingw32\bin and C:\msysgit\mingw\bin to the user PATH and restarting Spyder before running pip install again
–
endolith
Nov 26 '11 at 6:11
|
|
There is no need ever to reboot because of an environment variable change. Opening a new cmd.exe process is enough.
–
Tomalak
Jun 29 '12 at 8:47
|
|
I still couldn't fix this. This is the error: gcc: error: unrecognized command line option '-mno-cygwin' error: Setup script exited with error: command 'gcc' failed with exit status 1 after easy_install.exe amara
–
user
Sep 17 '13 at 13:17
|
show 2 more comments
|
|
|
answered May 12 '11 at 19:55
|
|
|
|
just a tip: you can install the package from this site in virtualenv by running easy_install binary_installer_built_with_distutils.exe in virtualenv, accoding to this answer.
–
yangzh
Sep 7 '13 at 4:32
|
|
|
|
|
add comment
|
|
I just had this same problem, so I'll tell my story here hoping it helps someone else with the same issues and save them the couple of hours I just spent:
I have mingw (g++ (GCC) 4.6.1) and python 2.7.3 in a windows 7 box and I'm trying to install PyCrypto.
It all started with this error when running setup.py install:
error: Unable to find vcvarsall.bat
Easily solved after googling the error by specifying mingw as the compiler of choice:
setup.py install build --compiler=mingw32
The problem is that then I got a different error:
configure: error: cannot run C compiled programs.
It turns out that my anti-virus was blocking the execution of a freshly compiled .exe. I just disabled the anti-virus "resident shield" and went to the next error:
cc1.exe: error: unrecognized command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1
This solved it: "Either install a slightly older version of MinGW, or edit distutils\cygwinccompiler.py in your Python directory to remove all instances of -mno-cygwin." (from here)
Now, I can finally start working.
|
|
answered May 8 '12 at 15:31
|
|
|
add comment
|
|
At least I found my solution from drawing feedback from other answers using the Visual
Studio C++ 2008 compilers rather than installing through the mingw32 path.
Here's the steps:
Download and install specifically Visual Studio C++ 2008 Express Edition.
Update for x64 Compilers: By default this will only give you a 32-bit compiler. I learned (from here and here) that you can download specifically the Windows SDK for Windows 7 and .NET Framework 3.5 SP1 which gives you a x64 compiler for VC++ 2008 (VC++ 9.0) if you need it. Just when you are installed it, you can uncheck everything except Developer Tools >> Visual C++ Compilers which will keep you from installing all the extra SDK tools that you may not need.
tl;dr: If you want the x64 compilers for VC++ 2008, download specifically the Windows SDK for Windows 7 and .NET Framework 3.5 SP1 and uncheck everything except Developer Tools >> Visual C++ Compilers during install.
Note: If you have both a 32- and 64-bit Python installation, you may also want to use virtualenv to create separate Python environments to use one or the other at a time without messing with your path to choose which Python version to use.
Note: Apparently, you may be able to skip all of this by copying a few batch files according to @srodriguex following this answer. If that works great, otherwise, here is at least what worked for me.
Open up a cmd.exe
Before you try installing something which requires C extensions, run the following batch file to load the VC++ compiler's environment into the session (i.e. environment variables, the path to the compiler, etc).
Execute:
32-bit Compilers:
Note: 32-bit Windows installs will only have C:\Program Files\ as expected
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat"
64-bit Compilers:
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\vsvars64.bat"
Note: Yes, the native 64-bit compilers are in Program Files (x86) . Don't ask me why.
Additionally, if you are wondering what the difference between vcvars64.bat and vcvarsx86_amd64.bat or more importantly the difference between amd64 and x86_amd64 , the former are for the native 64-bit compiler tools and the latter are the 64-bit cross compilers that can run on a 32-bit Windows installation.
Update:
If for some reason you are getting error: ... was unexpected at this time. where the ... is some series of characters, then you need to check that you path variable does not have any extraneous characters like extra quotations or stray characters. The batch file is not going to be able to update your session path if it can't make sense of it in the first place.
If that went well, you should get one of the following messages depending on which command you ran:
For the 32-bit compiler tools:
Setting environment for using Microsoft Visual Studio 2008 x86 tools.
For the 64-bit compiler tools:
Setting environment for using Microsoft Visual Studio 2008 x64 tools.
Now, run the setup via python setup.py install or pip install pkg-name
Hope and cross your fingers that the compiler actually works today.
|
|
answered Aug 4 '13 at 16:48
|
|
|
|
Cannot recommend enough that you do go through the pain of moving straight to 64 bit. It's just a matter of time before you'll need more than 4gb of address space. I speak from painful experience after having gone 32 bit because it was much easier, then having to uninstall everything including dependencies and going 64 bit. Almost a whole weekend.
–
Thomas Browne
Feb 9 at 9:31
|
|
Then again, I forget how many people are going to have to use Python for much larger tasks like that. And @ThomasBrowne, I'm sure that was a painful and an unnecessary evil of an experience. I'm looking into it, and hopefully I can find something. The main issue was that Visual Studio C++ 2008 Express does not come with a 64-bit compiler, but I'm sure its around here somewhere.
–
Jaxrtech
Feb 9 at 20:25
|
|
Just updated it with more information covering how to also get the 64-bit compilers if you need them.
–
Jaxrtech
Feb 11 at 21:04
|
|
|
|
@srodriguex well in that case, it looks like Python is assuming that the 64-bit compiler tools get loaded into the PATH using that it is looking for ...\VC\bin\vcvarsamd64.bat and ...\VC\bin\amd64\vcvarsamd64.bat .
–
Jaxrtech
Apr 13 at 19:58
|
show 1 more comment
|
|
I have python 2.73 and windows 7 .The solution that worked for me was:
- Added mingw32's bin directory to environment variable: append PATH with
C:\programs\mingw\bin;
Created distutils.cfg located at C:\Python27\Lib\distutils\distutils.cfg containing:
[build]
compiler=mingw32
To deal with MinGW not recognizing the -mno-cygwin flag anymore, remove the flag in C:\Python27\Lib\distutils\cygwincompiler.py line 322 to 326, so it looks like this:
self.set_executables(compiler='gcc -O -Wall',
compiler_so='gcc -mdll -O -Wall',
compiler_cxx='g++ -O -Wall',
linker_exe='gcc',
linker_so='%s %s %s'
% (self.linker_dll, shared_option,
entry_point))
| d vcvarsall.bat
|