0

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

Harshal Parekh
  • 5,918
  • 4
  • 21
  • 43
EOB
  • 13
  • 5
  • Do you mean `pip install mysql`? And do you have MySQL installed on your machine? – Harshal Parekh Apr 05 '20 at 22:35
  • Does this answer your question? [pip install mysql-python fails with EnvironmentError: mysql\_config not found](https://stackoverflow.com/questions/5178292/pip-install-mysql-python-fails-with-environmenterror-mysql-config-not-found) – AMC Apr 05 '20 at 22:47

1 Answers1

0

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
Harshal Parekh
  • 5,918
  • 4
  • 21
  • 43
  • Hello thank you for the message. once i installed brew am i going to select all or one of these below i.e BREW INSTALL MYSQL, BREW LINK MYSQL, PIP INSTALL MYSQL -PYTHON.......Thanks – EOB Apr 06 '20 at 15:05
  • @EOB, all of them. Also don’t forget to mark the answer accepted for future readers if it works for you. – Harshal Parekh Apr 06 '20 at 15:10
  • sure i will im just waiting for the installation to complete – EOB Apr 06 '20 at 15:15
  • The download couldnt complete i got this error message Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'... remote: Enumerating objects: 703361, done. error: RPC failed; curl 18 transfer closed with outstanding read data remaining fatal: the remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core` exited with 128. Error: Failure while executing; `/usr/local/bin/brew tap homebrew/core` exited with 1. – EOB Apr 06 '20 at 15:17
  • Looks like you might have a slow internet connection, try again – Harshal Parekh Apr 06 '20 at 15:22
  • Yes because it keep failing – EOB Apr 06 '20 at 16:04
  • You may google and find out the steps to install homebrew and continue the remaining steps. If it doesn’t work, create another question on SO for homebrew installation. – Harshal Parekh Apr 06 '20 at 16:05
  • i noticed something when i run the command inside the venv is normally slow but the outside venv it is faster. my entire project is in the virtual environment thats where i want to install mysql and workbench – EOB Apr 06 '20 at 16:09
  • You need to install MySQL in your machine, not in venv. Open a new terminal and install homebrew and MySQL there. – Harshal Parekh Apr 06 '20 at 16:12