"Unable to find vcvarsall.bat" error on windows - python

6 hours ago i started searching for a solution to compile the c extentions for python 2.7 on windows 7.
I tried all possible solutions like taking an older MINGW version or trying it with the tdm-mingw version (4.4.) Also i tried to change the
"-Wall -mno-cygwin"
from the cygwinccompiler
and created the new file distutils.cfg with the new build
but i still get "at least" this error:
"error: command 'gcc' failed with exit status 1"
Is there anyone out there who can compile something like "pip install lxml" under windows?
If yes... please share your wisdom...;)
What kind of MINGW version are you running...what's your python version or how does your modified cygwinccompiler.py look like?

Have you tried Microsoft's Visual C++ Compiler?
If not, you may want to download "Microsoft Visual C++ Compiler for Python 2.7" here to see if you can avoid the "Unable to find vcvarsall.bat" error : https://www.microsoft.com/en-us/download/details.aspx?id=44266
That usually works for me on Windows with Python 2.7

Related

After compilation of any Python program with Nuitka I get "is not a valid win32 application" error

I'm trying to compile my Python project to a Windows executable (.exe) using Nuitka. I get no errors/warnings during the compilation process, but when I'm trying to run the resulting executable I get the "C:\Python34\test.exe is not a valid win32 application" error on Windows XP and a similar one on Windows 10, too). The problem persists even when I compile a "Hello, World!" program. Interesting, that I can easily build and run C++ projects from the Visual Studio IDE on the same PC.
I'm using Windows XP (x32 bits), Python 3.4.0 and Microsoft Visual C++ 2008 Professional.
How can I solve this problem?
I have installed Microsoft Visual Studio 2010 Express instead of Microsoft Visual Studio 2008 Professional, and the problem disappeared. It looks like Nuitka just can't work with the previous version of the compiler. They even say in the docs, that Nuitka is designed for Visual Studio 2017+ (but I can't install recent versions on Windows XP), and that other versions may not work correctly.
I used tried the first steps from the Nuitka website and had the same with example 1. What I found: example 1 uses --mingw64 as option.
python -m nuitka --mingw64 hello.py
In example 2/Use Case 1 there is another option introduced:
python -m nuitka --follow-imports program.py
I only copied my hello-code from example 1 (working) and renamed it to program.py (failed - even no executable!). So I am shure, the cause will be the call and not the code.
When I entered --mingw64 to the second call it worked.
My first thought (I am new to this and no expert for nuitka) is that the second example call implicitly uses gcc. At the first time it asks for installing it and then it seems to use it. The first call seems to force mingw64 as compiler. Could also be that the sequence of path entries makes a difference. Just the first entry will be executed unless you force it via an explicit option.

pip installations failed: cl.exe failed with exit status 2

I know, there are many similar questions. I tried all solutions but non of them worked for me. I've been trying for hours and am now indescribably in a bad mood.
I want to install a few packages using pip (for example pip install mysql), but I always get (since 5 hours) this error:
_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
error: command 'C:\\Users\\myName\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
I do not understand whose idea it was to program such a stupid bug in Python, or that meaningless error. Sackoverflow is full of questions of this kind.
However, I installed Visual Studio 2015 and GCC (MinGW). Im using Python 2.7 which must be compatible to Visual C++ for Python 9.0. Nothing solved my problem. Downloading a precompiled file wouldn't solve the main issue. I'm hating python since ever but the last 5 hours put me on a new level of hating.
Now, a few hours later a found the solution. I don't know why, but you can't install mysql, mysql-python or mysqldb, because something is wrong with the package. (see "Cannot open include file: 'config-win.h': No such file or directory" while installing mysql-python) I don't understand, how someone can publish a broken installer but however they did.
The solution that worked for me is, using
pip install mysql-connector-python
instead. Thats it. It took me about 6 hours to find that out. More about that: https://dev.mysql.com/doc/connector-python/en/connector-python-installation-binary.html

Python imports not working in Visual Studio, Win 10

I cannot get certain imports to work in Python, in Visual Studio, on Windows 10. I installed them using the command:
python -m pip install scikit-learn
and it says they are saved to:
c:\users\[My Name]\appdata\local\programs\python\python35-32\lib\site-packages
However, when I try to use them in the program I get the error:
Unable to resolve "sklearn". IntelliSense may be missing for this module.
Originally I thought the problem was because I have two hard drives, but both the Python application and Visual Studio are also saved to the C drive. What should I do from here?

Python on Windows - compiling

Like many before me I don´t succeed in installing a few Python packages (mysql, pycld2, etc.) on Windows. I have a Windows 8 machine, 64-bit, and Python 3.4. At first I got the well-known error "can´t find vcvarsall.bat - install VS C++ 10.0". This I tried to solve by installing MinGW and use that as compiler. This did not work. Then finally I found an installer for this VS C++ 10.0 here http://microsoft-visual-cpp-express.soft32.com/free-download/. This doesn´t work too good either. Now it seems to find the vcvarsall file but instead gives me a couple of new errors
nclude -IC:\Python34\include /Tc_mysql.c /Fobuild\temp.win32-3.4\Release\_mysql.
obj /Zl_mysql.c_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h':
No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\cl.exe' failed with exit status 2
And:
pycldmodule.cc
bindings\pycldmodule.cc(16) : fatal error C1083: Cannot open include file: '
strings.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\cl.exe' failed with exit status 2
So now it doesn´t find strings.h and config-win.h and I´m too new to these sorts of problems to know what to look for. Anyone knows what I should do?
The thing is that I could just not use Windows and go over to Ubuntu as, for what I´ve understood, works painlessly with python. However, I have to use the win32com package which doesn´t exist on Ubuntu (have I understood that right?).
If I can´t solve these installing hassles on Windows, would a solution be to use a Windows virtual machine for the win32com part and do the rest on a host Ubuntu (or the other way around)? Would there be anyway to communicate between the two in that case? I.e. sending strings or arrays of data.
I have faced the exact same issues for Python 2.7 on 64 bit Windows trying to install pycld2.
Tried many methods like installing VS express 2008, MingW, etc and it just doesnt work.
What saved me is this link:
https://github.com/aboSamoor/polyglot/issues/11
The proposed solution is to download the binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/ and pip install .whl
The cpXX denotes the version of python. So in my case, I used cp27.
Hope it helps
I would recommend installing Ubuntu (as a Ubuntu user), you can dual-boot. However, that isn't an answer.
MySQLClient (the fork for Python3) is available a precompiled binary from here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient
Try to find precompiled binaries for simplicity sake. As far as troubleshooting the install goes, I've tried the recommend VC Studio 9.0 on fresh installs and it cannot find stdint.h (which, like yours, suggests it's more than broken).
You could try http://www.activestate.com/activepython/downloads for Windows. I t includes compiled binaries, avoiding the need for a C complier.
I grew frustrated with trying to get python and other packages to compile/play nicely on Windows as well. Switching over to Ubuntu was a breath of fresh air, for sure.
The win32com package is made specifically for Windows hosts, so that could not longer be used, but there are other ways to achieve the same thing in Ubuntu.
Are you trying to target Windows specifically? What are you using win32com for?
Looks like you're missing MySQL dev package. Another StackOverflow question has the details. But if I were you, I'd go the route Alexander Huszagh recommended and get my precompiled binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient

error: Unable to find vcvarsall.bat to compile python modules with Visual Studio 2008 installed

I', trying to compile a Python modules on Windows 7 ( Python 3.3 ) and getting the error: Unable to find vcvarsall.bat which i read around is related to not having Visual Studio 2008 installed. Bu i have visual studio 2008 installed AND it's in the path, any ideas?
EDIT - i also checked How do I point easy_install to vcvarsall.bat? but no effects, i tried setting the variable but it's ignored.
EDIT 2 - I've found out by looking at the core that it's now looking for VS100COMNTOOLS instead of VS90COMNTOOLS is the VS studio version different?
Python 3.3 on Windows is built with VS2010, which doesn't match your VS2008. Previous versions of Python did indeed use VS2008.
You'll need to get hold of VS2010.

Categories

Resources