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

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

Related

‘pip install pybullet’ causes error “cannot open input file ‘Ws2_32.lib’”

When pip install pybullet is entered into the command prompt, the wheel fails to build and “errors out with exit status 1” then after a long list of red text it says: LINK : fatal error LNK1181: cannot open input file ‘Ws2_32.lib’ before trying and failing to build the wheel again with the same error. What does this mean and how can I fix it?
My first problems were the same as the ones in this question but I resolved those by adding the file locations to the path. I was going to try the same solution with this problem but I could not find Ws2_32 on the computer. I think this has something to do with it being an input file. There are several files named WS2_32 (where the s is capitalized) that are in similar places to the other files I needed to add to PATH but adding them to the path or LIB does not change anything. I have tried most of the solutions I have found online, though there are not many. I just do not know how to make sure the computer can find a file that I can’t. Does this mean I just don’t have it? Is there anywhere I can download it? I have also restarted the computer several times.
I have installed pybullet successfully on another computer and I have tried to make my Visual Studio installation look similar (pybullet requires Visual Studio).
I am using Python 3.6 64bit, Pip is upgraded, and Windows 7. The only difference that I think might matter between the two computers is that the successful one runs Windows 10. I can provide more information if it is needed. Thanks for the help.
I installed pybullet in VS Code without wheel installed and it gets installed successfully.
Maybe try installing it without using wheel.

Nuitka Error, implicit module 'sklearn.utils._unittest_backport' expected by 'sklearn.utils' not found

I am trying to compile my python script into single EXE. Nuitka can do this and has an acceptable license (Apache free license https://nuitka.net/pages/overview.html).
I was able to resolve 2 warnings by adding command line params below but I can't resolve the error below.
I've searched the web for a combination of Nuitka AND the error below but don't receive results specific enough to solve the issue.
I know it may be difficult to troubleshoot without the code, however let me know if there is a portion of the code I should extract to repro.
Do I need to somehow install "sklearn.utils._unittest_backport" to resolve this error?
I am running the following:
Nuitka v0.6.4
Python: 3.7.0
MSC v.1912 64 bit
OS: Windows
Arch: x86_64
The command line I am using is:
python -m nuitka --standalone --plugin-enable=sklearn --plugin-enable=numpy --nofollow-import-to=sklearn.utils._unittest_backport MyFile.py
The error I receive is:
Error, implicit module 'sklearn.utils._unittest_backport' expected by 'sklearn.utils' not found.
Any help you can provide would be appreciated.
I found a way to work around the error above. I ran
pip install --user -U scikit-learn
To check, I ran the following from the Python command line and it completed successfully:
import sklearn.utils._unittest_backport
I had scikit-learn previously installed, but it seems to have been missing the files I needed.
FYI, _unittest_backport.py is here:
C:\ProgramData\Anaconda3\Lib\site-packages\sklearn\utils

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

Windows / PyPi / PyCharm linker errors when compiling some cython modules

currently, i am working with PyCharm on Windows, and i tried to install some packages via PyPi. For convinience, i used the integrated functionality of PyCharm, which does essentially the same as the shell easy_install.
However, when installing packages which have to be compiled with gcc, i get some errors. I already browsed a lot of questions here on stackoverflow because of the former errors, and managed to overcome some of the errors (using mingw64, removing the -mno-cygwin parameter from the setup scripts etc) but now i'm totally stuck on this one:
build\temp.win-amd64-2.7\Release\cpyamf\amf0.o:amf0.c:(.text+0xb912): undefined reference to `__imp_PyExc_ImportError'
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/../../../../x86_64-w64-mingw32/bin/ld.exe: build\temp.win-amd64-2.7\Release\cpyamf\amf0.o: bad reloc address 0x78 in section `.data'
collect2.exe: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
The error occurs on the installation of PyAMF and Twisted, which use cython for some parts. I couldn't find a solution for that one yet.
Thanks in advance.
I solved it with help from the folks at #python on freenode. Or better: found a workaround.
The problem was basically that i used 64 bit python on windows, which doesn't really work well with minGW64 and stuff.
I installed 32 bit Python, edited the distutils.cfg fixed the -mno-cygwin problem and it basically worked out of the box.
So if anyone else encounters this problem: Use 32 bit Python.

"Unable to find vcvarsall.bat" error on windows

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

Categories

Resources