Hi,
Im trying to pip install mysql-python and I keep getting an error. I was wondering if anyone knows what I need to do get this working?
I'm using Windows 10, python 3.6 and mysql 5.7. I'm new to coding so if there is something I missed please let me know. Thanks
This is the error I keep getting:
_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\2017\Community\VC\Tools\MSVC\14.13.26128\bin\HostX86\x64\cl
.exe' failed with exit status 2
You can download unofficial windows binaries for your python version using https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient.Then install it using pip. This way you'll be able to avoid the hassle of dealing with visual studio build tools.
Just download the mysqlclient.whl file most applicable to you(for python 3 versions).
I think in your case it'll be
mysqlclient‑1.3.13‑cp36‑cp36m‑win32.whl(if your machine is 32 bits)
mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl(if your machine is 64 bits)
and then in command prompt, change the location to the directory where the downloaded file is, by :
cd "the path to the downloaded file"
and run the file:
pip install mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl
Related
I try to install Python package hdt on Windows 10. I need hdt because it is a dependency of a big package I need.
There is a c++ error while building whl on Windows. Building of whl starts after command pip install hdt.
The error is:
cl: Є®¬ ¤ п бва®Є warning D9002: Їа®ЇгбЄ ҐЁ§ўҐбв®Ј® Ї а ¬Ґва "-std=c++11"
BitSequence.cpp
hdt-cpp-1.3.3/libcds/include/libcdsBasics.h(27): fatal error C1083: ЌҐ г¤ Ґвбп ®вЄалвм д ©« ўЄ«о票Ґ: sys/resource.h: No such file or directory,
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
There are setuptools updated.
There are MS Build Tools installed as it said here: https://stackoverflow.com/a/55575792/10963649
I tried it on Linux and I've installed hdt easily on Linux but I don't want to change the platform because of problems with one package.
Some questions you could help me with:
Is it possible that whl could be built only on Linux?
My MS VS is x86 as I see in error (C:\Program Files (x86)\...). Shalln't I choose x86 versions of MS BuiltTools components?
There is a warning D9002: ignoring unknown option '-std=c++11'. What should be done (installed) to prevent it?
The final error is C1083 Cannot open include file: sys/resource.h: No such file or directory. Could it be caused by the lack of MS Built Tools components? It looks strange though
Any other ideas how to build whl for hdt?
Maybe as a workaround it could be considered: as there is hdt installed on Linux maybe it's possible to build a whl on Linux and then copy on Windows. But there is .so file on Linux and I'm not sure it's possible to add .so in whl and then install it on Windows.
I am trying to use mysql with python SQLAlchemy but while installing mysqlclient for python its giving error. kindly check details below:
I'm running this on Windows 10 64 bit and Anaconda Python 3.7.4
I have tried by installing another python version as well but no luck.
Tried to install MYSQL connector c++ as well. but still not working.
If I run code 'pip install mysqlclient'
mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\cl.exe' failed with exit status 2
based on this Answer, you can download unofficial windows binaries for your python version using https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient. for example, "mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl".
Then install it using pip.
pip install "path to the downloaded .whl file"
Note: In the name of the wheels, there are numbers that show this wheel is for which python version. for example if only you have python version 3.6, you can use "mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl".
After all, if you still have error, try 32bit version of wheels.
I just got an answer by looking at other options mentioned here.
Actually mistake was that,
I have installed Python 3.7.4 with 32 bits on 64bits machine.
Code was looking for below path but it was going to the wrong path in program files instead of program files(x86)
C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib
I have installed a new Python with 3.7 with 64 bits and also while installing MySQL connector I have changed the path of installation to the above-mentioned path and now it's working fine.
Thank you, everyone, for your time and help
I am trying to use mysql with python SQLAlchemy however python fails to install MySQL or even recognize it is installed. Below are the details:
I'm running this on Windows 10 64 bit and Anaconda Python 3.6.5
I downloaded MySQL through MAMP: Mac-Apace-MySQL-PHP
https://www.mamp.info/en/
I have tried running my code on VSC and Jupyter.
If I try running the code pip install mysqlclient
_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\cl.exe' failed with exit status 2
I tried pip install MySQL-python but get
_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\2017\BuildTools\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\cl.exe' failed with exit status 2
I tried pip install MySQLdb and get:
Collecting MySQLdb
Could not find a version that satisfies the requirement
MySQLdb (from versions: )
No matching distribution found for MySQLdb
I tried installing MySQL - from the actual Oracle website, did not work
I tried downloading the MySQL-connector to python: I get
python v3.6 not found. we only support python using MSI.
I heave searched this issue on SoF but every issue is either outdated or custom geared towards that poster's case and I honestly would not know where to start. I've read that it may be a config issue to where python can't tell where MySQL is located and so I need to customize the path to it but I do not have the technical depth to meddle with that as I'm worried I may end up making it even worst.
I sincerely appreciate any input to this matter as I am truly in a bind and have no idea where to go from here.
Use the precompiled binary whl file from Cristoph Golke. It's far easier than setting up the complete dev environment to compile a single library.
Download the .whl file, then pip install <path to .whl> inside the python environment you're using.
I got this error while installing mysqlclient in my Django project.
_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\cl.exe' failed with exit status 2
I have found workaround to fix this issue.
The reason was to mysqlclient version mismatch according to your Python version
First, You can check python version
python --version
And then You can install mysqlclient version according to python version.
If python version is 3.7, then you can install mysqlclient==1.3.14 or directly download
mysqlclient-1.3.14-cp37-cp37m-win_amd64.whl file.
If you python version is 3.6, then you can install mysqlclient==1.3.13 or directly download
mysqlclient-1.3.13-cp36-cp36m-win_amd64.whl file.
Install the Mysql Connector/C and restart pip install mysqlclient. If your Visual C is properly installed it will work
Maybe you are opening something that uses the python process executing one of files need to be downloaded for installing (in my experience, I was opening Pycharm, and the process was using '_mysql.cp36-win_amd64.pyd' file)
Hope this helps someone
None of the solutions here and elsewhere worked for me. Turns out an incompatible 32bit version of mysqlclient is being installed on my 64bit Windows 10 OS.
I had to uninstall my current Python 3.7 32bit, and reinstalled Python 3.7 64bit and everything is working fine now
For install mysqlclient you need to Visual C++ 2015 Build Tools. Use below link to download visualstudio tool. http://go.microsoft.com/fwlink/?LinkId=691126&fixForIE=.exe.
Now you need to set your visual studio path in path variable by using below command in commandline.
“setx path "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC"”
Now you need to install mysqlclient by using below command
“pip install mysqlclient”
If you found error like “MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe' failed with exit status 2”
so you need to download .whl file for direct install, You can use below link to download as per your system compatibility.
“https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient.Then”
“mysqlclient-1.4.2-cp37-cp37m-win32.whl” file work for me.
“pip install mysqlclient-1.4.2-cp37-cp37m-win32.whl”
Mysqlclient is install now!!
You need to change setting.py according to mysql
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'learnpython',
'USER': 'nilesh',
'PASSWORD': 'Radhe#12',
'HOST': 'localhost',
'PORT': 3306
}
}
Enjoy now Django is connect with mysql!!
For more details "http://itfundasphp.blogspot.com/2019/06/django-connect-to-mysql.html"
I've had the same issue.
I simply downloaded python-64 installer and installed on my machine and choosed 64bit as interperter.
I didn't understand why 32bit python doesn't work here.
I hope this might be helpful.
pip install mysqlclient didn't worked for me
I tried pip install --only-binary :all: mysqlclient and worked like a charm
Im trying to install xmlsec (with pip) but it is throwing: error: pkg-config is not installed. Im using Python3.6 on windows 7.
Thanks in advance for any suggestion.
Xmlsec has some issues with windows but as with python 3.6 and below the problem is solved. Use this link to download the wheel file for your python version https://github.com/mehcode/python-xmlsec/releases
Install the wheel file using
pip install <wheel_file_name>
As with Python 3.7, the only way out is to install xmlsec on a Linux machine as it is not yet supported on Windows.
This seems to be a problem on Windows #Jcc.Sanabria on Windows. Where as Linux & MAC are seems to be working for xmlsec.
Since I had gone through this situations for around weeks now.
Going through official Document
here I didn't find any instruction on "How to install this on Windows?"
To answer your question :
Resolve your exception related with pkgconfig you can use this link on Windows.
But then it will also ask you to install Visual C++ (>=ver. 14.0) but after installing this too.
You will face exception like this one :
"cl : Command line error D8021 : invalid numeric argument '/Wno-error=declaration-after-statement'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2"
Which I didn't find any resolution till now. :(
But to use xmlsec and python on Windows working you need to take support from Cygwin. Where you can install all related packages from Cygwin Packages list for python and xmlsec dependancy. Following are the name & version of some packages :
gettext-devel(0.19.8.1-2),libglib2.0-devel(2.50.3-1),libxml2-devel(2.9.4-2),libxmlsec1-devel(1.2.24-1),libxslt-devel(1.1.29-1)
Further dependency can be checked on this link
I am attempting the installation of OpenPIV (python build) on 64-bit Win7.
Upon downloading the setup files(located - https://github.com/alexlib/openpiv-python) and running:
python setup.py install
I receive the error:
error: Unable to find vcvarsall.bat
Some research informed me to use:
python setup.py build --compiler=mingw32
Which then resulted in:
error: command 'gcc' failed: No such file or directory.
So, I installed MinGW and adjusted the PATH variable to include C:\MinGW\bin, where gcc.exe is located, but no dice. Following this, I tried restarting my command prompt, restarting my computer, reinstalling MinGW, and reinstalling the setup files.
Running gcc:
C:\OpenPIV\> gcc
gcc:fatal error: no input files
compilation terminated.
Which I assume means gcc works, but
python setup.py build --compiler=mingw32
still results in:
error: command 'gcc' failed: No such file or directory.
Thanks everyone. Any suggestions/tips would be greatly appreciated.
After hours and hours of searching, I've discovered that this is a problem between MinGW and Python. They don't communicate well with one another.
There exists a binary package of MinGW (unofficial) that was meant for use with Python located here
This fixes the problem!