I have a following problem. I would like to install MySQLdb. I try pip install mysqlclient but I got this error message:
Collecting mysqlclient
Using cached mysqlclient-2.1.1.tar.gz (88 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ydedt20p/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ydedt20p/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-ydedt20p/mysqlclient/pip-egg-info
cwd: /tmp/pip-install-ydedt20p/mysqlclient/
Complete output (15 lines):
/bin/sh: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-ydedt20p/mysqlclient/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-ydedt20p/mysqlclient/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-ydedt20p/mysqlclient/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version
mariadb_config --version
mysql_config --libs
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I am using Python 3.8 on Ubuntu. How can I fix it, please?
Please read and follow the installation instructions for Linux.
For Ubuntu,
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
to install the required libraries before attempting to
pip install mysqlclient
Related
I am building a flask project and I want to use MySQL database. I need flask-mysqldb as an ORM for that. So as a good practice, I created a virtual environment, install flask and other dependencies, and then for installing flask-mysqldb, I used pip install flask-mysqldb. This suddenly gives me bunch of errors. At first I realized, I dont have MySQL installed on my system. So even after installing it these errors won't go away. I also tried pip install Flask-MySQLdb don't know how this is different from the first command but same errors.
I tried searching for errors online regarding flask-mysqldb, but most of them relate to some mysql.h file error which doesn't show in my terminal logs.
(env) ck#ck-IdeaPad-Gaming-3-15ARH05:~/projects/opensoft/roomAlloc$ pip install Flask-MySQLdb
Collecting Flask-MySQLdb
Using cached Flask-MySQLdb-0.2.0.tar.gz (2.1 kB)
Requirement already satisfied: Flask>=0.10 in ./env/lib/python3.8/site-packages (from Flask-MySQLdb) (2.0.2)
Collecting mysqlclient
Using cached mysqlclient-2.1.0.tar.gz (87 kB)
ERROR: Command errored out with exit status 1:
command: /home/ck/projects/opensoft/roomAlloc/env/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-bra67idg/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-bra67idg/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-bra67idg/mysqlclient/pip-egg-info
cwd: /tmp/pip-install-bra67idg/mysqlclient/
Complete output (15 lines):
/bin/sh: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-bra67idg/mysqlclient/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-bra67idg/mysqlclient/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-bra67idg/mysqlclient/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version
mariadb_config --version
mysql_config --libs
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Please help me out, you can comment if you need more information.
I had the same error 2 minutes ago and find this command to solve the problem!
sudo apt-get install libmysqlclient-dev
the just try to install again and should work fine.
Credits:
I found this command here (In Spanish):
https://programmerclick.com/article/1483761552/
I just switched from Windows to Mac and cloned my repository. I have the Mac Mini 2020 with the new m1 chip.
I ran pip3 install -r requirements.txt and got the following error:
ERROR: Command errored out with exit status 1:
command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/t9/czy9qvr930l9s46j8b9k__th0000gp/T/pip-install-npqzencr/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/t9/czy9qvr930l9s46j8b9k__th0000gp/T/pip-install-npqzencr/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /private/var/folders/t9/czy9qvr930l9s46j8b9k__th0000gp/T/pip-install-npqzencr/mysqlclient/
Complete output (15 lines):
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/t9/czy9qvr930l9s46j8b9k__th0000gp/T/pip-install-npqzencr/mysqlclient/setup.py", line 15, in <module>
metadata, options = get_config()
File "/private/var/folders/t9/czy9qvr930l9s46j8b9k__th0000gp/T/pip-install-npqzencr/mysqlclient/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/private/var/folders/t9/czy9qvr930l9s46j8b9k__th0000gp/T/pip-install-npqzencr/mysqlclient/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version
mariadb_config --version
mysql_config --libs
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I tried with sudo after seeing another post about this issue:
sudo pip3 install -r requirements.txt and got this error:
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-jqyr1k_y/mysqlclient_c6d45690ebfd45cdbd081164dcfad4ce/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-jqyr1k_y/mysqlclient_c6d45690ebfd45cdbd081164dcfad4ce/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/tmp/pip-pip-egg-info-h6hpe889
cwd: /private/tmp/pip-install-jqyr1k_y/mysqlclient_c6d45690ebfd45cdbd081164dcfad4ce/
Complete output (15 lines):
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-install-jqyr1k_y/mysqlclient_c6d45690ebfd45cdbd081164dcfad4ce/setup.py", line 15, in <module>
metadata, options = get_config()
File "/private/tmp/pip-install-jqyr1k_y/mysqlclient_c6d45690ebfd45cdbd081164dcfad4ce/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/private/tmp/pip-install-jqyr1k_y/mysqlclient_c6d45690ebfd45cdbd081164dcfad4ce/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version
mariadb_config --version
mysql_config --libs
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/3c/df/59cd2fa5e48d0804d213bdcb1acb4d08c403b61c7ff7ed4dd4a6a2deb3f7/mysqlclient-2.0.3.tar.gz#sha256=f6ebea7c008f155baeefe16c56cd3ee6239f7a5a9ae42396c2f1860f08a7c432 (from https://pypi.org/simple/mysqlclient/) (requires-python:>=3.5). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mysqlclient==2.0.3 (from versions: 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.3.9, 1.3.10, 1.3.11rc1, 1.3.11, 1.3.12, 1.3.13, 1.3.14, 1.4.0rc1, 1.4.0rc2, 1.4.0rc3, 1.4.0, 1.4.1, 1.4.2, 1.4.2.post1, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 2.0.0, 2.0.1, 2.0.2, 2.0.3)
ERROR: No matching distribution found for mysqlclient==2.0.3
Versions:
Python 2.7.16
pip 19.2.3
When I run check my pip version it clearly shows python 3.8 there:
pip3 --version
pip 19.2.3 from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8)
Any tips would be LOVELY!
I’ve also had similar experience with M1. I think it’s due to the mysql config. So first of all locate where your mysql_config is ( it can either be in /opt or /bin directories). For instance mine is in:
/opt/homebrew/bin
Once you’ve found the file, you need to edit the file with your favorite editor (I use nano) and change this line in the configuration:
# Create options
libs="-L$pkglibdir"
libs="$libs -l "
change it to this:
# Create options
libs="-L$pkglibdir"
libs="$libs -lmysqlclient -lssl -lcrypto"
after editing install mysqlclient again. You can also ensure that gcc is already installed on your Mac
Im trying to install the mysqlclient on linux, and keeping reciving this error bellow.
I already tried update the:
sudo apt-get install build-essential
sudo apt-get install libssl-dev
And the error persit:
^C(venv) pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-2.0.2.tar.gz (88 kB)
ERROR: Command errored out with exit status 1:
command: /home/felipecid/PycharmProjects/djangoAgenda/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ct6grj28/mysqlclient_e1f80e76b30f4edaaa24bdcfc6a54e18/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ct6grj28/mysqlclient_e1f80e76b30f4edaaa24bdcfc6a54e18/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-1wsevah8
cwd: /tmp/pip-install-ct6grj28/mysqlclient_e1f80e76b30f4edaaa24bdcfc6a54e18/
Complete output (12 lines):
/bin/sh: mysql_config: comando não encontrado
/bin/sh: mariadb_config: comando não encontrado
/bin/sh: mysql_config: comando não encontrado
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-ct6grj28/mysqlclient_e1f80e76b30f4edaaa24bdcfc6a54e18/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-ct6grj28/mysqlclient_e1f80e76b30f4edaaa24bdcfc6a54e18/setup_posix.py", line 65, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-ct6grj28/mysqlclient_e1f80e76b30f4edaaa24bdcfc6a54e18/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
The problem is beacause im using the DISTR Linux Mint Version, just sawp for a regular Unbuntu version and works!
In mac OSX I have already installed mariadb 10.1.20 now while i Try to install mysql-python using pip install mysql-python system showing following error:
Collecting mysql-python
Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
ERROR: Command errored out with exit status 1:
command: /Users/eskimi/Development/ErpNext/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/1r/0z4_dp3j0237vqx1jvc0sn3c0000gp/T/pip-install-s0tXN_/mysql-python/setup.py'"'"'; __file__='"'"'/private/var/folders/1r/0z4_dp3j0237vqx1jvc0sn3c0000gp/T/pip-install-s0tXN_/mysql-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/1r/0z4_dp3j0237vqx1jvc0sn3c0000gp/T/pip-install-s0tXN_/mysql-python/pip-egg-info
cwd: /private/var/folders/1r/0z4_dp3j0237vqx1jvc0sn3c0000gp/T/pip-install-s0tXN_/mysql-python/
Complete output (10 lines):
sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/1r/0z4_dp3j0237vqx1jvc0sn3c0000gp/T/pip-install-s0tXN_/mysql-python/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "setup_posix.py", line 25, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
How can resolve this issue?
N.B I am using python 2.7
I am trying to import a python module called pattern in my code. However, when I run:
pip install pattern
I get the following output:
Collecting pattern
Using cached
https://files.pythonhosted.org/packages/1e/07/b0e61b6c818ed4b6145fe01d1c341223aa6cfbc3928538ad1f2b890924a3/Pattern-3.6.0.tar.gz
Collecting future (from pattern)
Using cached https://files.pythonhosted.org/packages/90/52/e20466b85000a181e1e144fd8305caf2cf475e2f9674e797b222f8105f5f/future-0.17.1.tar.gz
Collecting backports.csv (from pattern)
Using cached https://files.pythonhosted.org/packages/8e/26/a6bd68f13e0f38fbb643d6e497fc3462be83a0b6c4d43425c78bb51a7291/backports.csv-1.0.7-py2.py3-none-any.whl
Collecting mysqlclient (from pattern)
Using cached https://files.pythonhosted.org/packages/4d/38/c5f8bac9c50f3042c8f05615f84206f77f03db79781db841898fde1bb284/mysqlclient-1.4.4.tar.gz
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4Proy9/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4Proy9/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /tmp/pip-install-4Proy9/mysqlclient/
Complete output (12 lines):
sh: 1: mysql_config: not found
sh: 1: mariadb_config: not found
sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-4Proy9/mysqlclient/setup.py", line 16, in <module>
metadata, options = get_config()
File "setup_posix.py", line 61, in get_config
libs = mysql_config("libs")
File "setup_posix.py", line 29, in mysql_config
raise EnvironmentError("%s not found" % (_mysql_config_path,))
EnvironmentError: mysql_config not found
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I already have mysql installed and I've tried installing mysqlclient as well. I am not sure what to do!
To build/install mysqlclient you will need mysqlclient libraries and header files. To determine their location mysqlclient needs to call mysql_config script (which was not found).
You need to install mysql client library. (e.g. libmysqlclient-dev). Also make sure that mysql_config script is in your path.