error when pip install mysqlclient in mac [duplicate] - python

This question already has answers here:
Mac OS X - EnvironmentError: mysql_config not found
(10 answers)
Closed 3 years ago.
when I try to pip install mysqlclient for python show this error
ERROR: Command errored out with exit status 1:
command: /Users/als/Desktop/Projects/sin/venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/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 /private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/pip-egg-info
cwd: /private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/
Complete output (12 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/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/setup.py", line 16, in <module>
metadata, options = get_config()
File "/private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/setup_posix.py", line 61, in get_config
libs = mysql_config("libs")
File "/private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/setup_posix.py", line 29, in mysql_config
raise EnvironmentError("%s not found" % (_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.

To solve this problem just need two steps:
brew install mysql
LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient

Related

FileNotFoundError: [Errno 2] No such file or directory: 'readme.md'

Im trying to install ghasedak package via pip which i have done before but now it raises this error.
(venv) hamed#hamed-HP-250-G6-Notebook-PC:~/sqh-source$ pip3 install ghasedak --upgrade
Collecting ghasedak
Using cached ghasedak-0.1.8.tar.gz (2.0 kB)
ERROR: Command errored out with exit status 1:
command: /home/hamed/sqh-source/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vb0m4x9b/ghasedak/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vb0m4x9b/ghasedak/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-vb0m4x9b/ghasedak/pip-egg-info
cwd: /tmp/pip-install-vb0m4x9b/ghasedak/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-vb0m4x9b/ghasedak/setup.py", line 3, in <module>
with open("readme.md", "r") as fh:
FileNotFoundError: [Errno 2] No such file or directory: 'readme.md'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
After a lot of search i found someone said i have to make MANIFEST.in but where should i place it and someone said we dont need that then finally is it right to use it or is there any other solution?
My problem didnt solve so I downloaded ghasedak from github with the below command
pip install git+https://github.com/package-url/

pip install MySQL-python==1.2.5 not working [duplicate]

This question already has answers here:
pip install mysql-python fails with EnvironmentError: mysql_config not found
(24 answers)
Closed 2 years ago.
I'm trying to install MySQL-python with pip.
I'm using Python v2.7.18 and pip v20.3.4
I'm trying it with:
pip install MySQL-python==1.2.5
But it gives this error:
Defaulting to user installation because normal site-packages is not writeable
Collecting MySQL-python==1.2.5
Using cached MySQL-python-1.2.5.zip (108 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zuV7aL/mysql-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-zuV7aL/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 /tmp/pip-pip-egg-info-TefBrj
cwd: /tmp/pip-install-zuV7aL/mysql-python/
Complete output (10 lines):
sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-zuV7aL/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.
What am I doing wrong?
You need to install dev libs for mysql client:
sudo apt-get install libmysqlclient-dev

How to Correctly install MySQL module in Python

I am new to coding and ubuntu, and I am trying to insert some data to MySQL using Python, but I am having some error in installing the mysql module.
I am having this error:
**pip install mysql**
Defaulting to user installation because normal site-packages is not writeable
Collecting mysql
Using cached mysql-0.0.2.tar.gz (1.9 kB)
Collecting mysqlclient
Using cached mysqlclient-2.0.2.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-8pt10wd4/mysqlclient_5e8d8ff6d905420ea115c27e23267248/setup.py'"'"'; __file__='"'"'/tmp/pip-install-8pt10wd4/mysqlclient_5e8d8ff6d905420ea115c27e23267248/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-ocgktfp6
cwd: /tmp/pip-install-8pt10wd4/mysqlclient_5e8d8ff6d905420ea115c27e23267248/
Complete output (12 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-8pt10wd4/mysqlclient_5e8d8ff6d905420ea115c27e23267248/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-8pt10wd4/mysqlclient_5e8d8ff6d905420ea115c27e23267248/setup_posix.py", line 65, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-8pt10wd4/mysqlclient_5e8d8ff6d905420ea115c27e23267248/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.
pip install mysql-connector-python try this , if you are still facing the issue, check your python version, make sure it is python3.8 and above.
Hello and welcome to Python! A popular library used for interacting with MySQL database servers is "PyMySQL" and this can be found at: https://pypi.org/project/PyMySQL/
Installation Command:
pip install pymysql
You can view example usage here: https://pypi.org/project/PyMySQL/#example

Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output - while installing pycopy-fcntl through pip

I was trying to install pycopy-fcntl via pip package installer but it was giving this error(newbie in stackoverflow).
ERROR: Command errored out with exit status 1:
command: 'c:\users\lg\appdata\local\programs\python\python37\python.exe' -c 'import sys, setuptools,
tokenize; sys.argv[0] = '"'"'C:\\Users\\lg\\AppData\\Local\\Temp\\pip-install-bjhg1nur\\pycopy-
fcntl\\setup.py'"'"'; __file__='"'"'C:\\Users\\lg\\AppData\\Local\\Temp\\pip-install-
bjhg1nur\\pycopy-fcntl\\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 'C:\Users\lg\AppData\Local\Temp\pip-pip-egg-info-
00tiv3i6'
cwd: C:\Users\lg\AppData\Local\Temp\pip-install-bjhg1nur\pycopy-fcntl\
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\lg\appdata\local\programs\python\python37\lib\tokenize.py", line 447, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\lg\\AppData\\Local\\Temp\\pip-install-bjhg1nur\\pycopy-fcntl\\setup.py'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I had tried this code pip install --upgrade setuptools still the error arrives.
I can't understand, what is the error telling about?
Thanks in advance, Sir/Mam.
The source code doesn't have setup.py
The package lacks almost all files including setup.py.
The bottom line: the package is either broken or is not intended to be installed with pip.

Error messages when i want to pip install mysql-python and mysqlclient with MacOS

I'm currently working on a project using Django with python2.7 but each time I try pip install mysqsl I get this error messages
"" ERROR: Command errored out with exit status 1:
command: 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/jb/4wfxz94x599f8rnhtgkbs92c0000gn/T/pip-install-FpxjOl/mysql-python/setup.py'"'"'; __file__='"'"'/private/var/folders/jb/4wfxz94x599f8rnhtgkbs92c0000gn/T/pip-install-FpxjOl/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/jb/4wfxz94x599f8rnhtgkbs92c0000gn/T/pip-install-FpxjOl/mysql-python/pip-egg-info
cwd: /private/var/folders/jb/4wfxz94x599f8rnhtgkbs92c0000gn/T/pip-install-FpxjOl/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/jb/4wfxz94x599f8rnhtgkbs92c0000gn/T/pip-install-FpxjOl/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.""
Any help please
Most likely you have not installed mysql on your machine.
MySQLdb is a python interface for mysql, but it is not mysql itself. And apparently MySQLdb needs the command 'mysql_config', so you need to install that first.
You can install MySQL with brew.
xcode-select --install
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Once you have brew installed:
brew install mysql
brew link mysql
pip install MySQL-python

Categories