# Error When installing mysqlclient

**URL:** https://forum.codewithmosh.com/t/error-when-installing-mysqlclient/13665
**Category:** Django
**Created:** [July 14, 2022, 1:43am UTC](https://forum.codewithmosh.com/t/error-when-installing-mysqlclient/13665 "2022-07-14T01:43:50Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![SUPERCAT](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@SUPERCAT](https://forum.codewithmosh.com/u/SUPERCAT)
#### Post date: [July 14, 2022, 1:43am UTC](https://forum.codewithmosh.com/t/error-when-installing-mysqlclient/13665/1 "2022-07-14T01:43:50Z")

</div>

Python Version == 3.10.5

**This is the error I’m getting.**

Installing mysqlclient…  
Error: An error occurred while installing mysqlclient!  
Error text: Collecting mysqlclient  
Using cached mysqlclient-2.1.1.tar.gz (88 kB)  
Preparing metadata (setup.py): started  
Preparing metadata (setup.py): finished with status ‘error’

error: subprocess-exited-with-error

× python setup.py egg\_info did not run successfully.  
│ exit code: 1  
╰─\> [16 lines of output]  
/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 “”, line 2, in   
File “”, line 34, in   
File “/private/var/folders/9d/\_sspqdqx72j3xbj\_00\_4tnnc0000gn/T/pip-install-7p4nuy3n/mysqlclient\_6a8def8547594e6581afcc9bbc2b1f30/setup.py”, line 15, in   
metadata, options = get\_config()  
File “/private/var/folders/9d/\_sspqdqx72j3xbj\_00\_4tnnc0000gn/T/pip-install-7p4nuy3n/mysqlclient\_6a8def8547594e6581afcc9bbc2b1f30/setup\_posix.py”, line 70, in get\_config  
libs = mysql\_config(“libs”)  
File “/private/var/folders/9d/\_sspqdqx72j3xbj\_00\_4tnnc0000gn/T/pip-install-7p4nuy3n/mysqlclient\_6a8def8547594e6581afcc9bbc2b1f30/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  
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.  
error: metadata-generation-failed

× Encountered error while generating package metadata.  
╰─\> See above for output.

note: This is an issue with the package mentioned above, not pip.  
hint: See above for details.

This is likely caused by a bug in mysqlclient. Report this to its maintainers.  
✘ Installation Failed

---

<div class="post-metadata">

### Author: ![tooTALLtim](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/tootalltim/32/5469_2.png) [@tooTALLtim](https://forum.codewithmosh.com/u/tooTALLtim)
#### Post date: [August 4, 2022, 6:42pm UTC](https://forum.codewithmosh.com/t/error-when-installing-mysqlclient/13665/2 "2022-08-04T18:42:47Z")

</div>

I had basically the same issue in Ubuntu, and found I needed to install the “python3-dev default-libmysqlclient-dev build-essential” despite already having installed MySQL previously and verifying it worked in my VS Code terminal.

I ran

`sudo apt-get install python3-dev default-libmysqlclient-dev build-essential`

and then was able to successfully install mysql client in my virtual environment! Please see what you need to run for your OS.

Reference: [Command errored out with exit status 1: python setup.py egg\_info Check the logs for full command output while installing mysqlclient - Stack Overflow](https://stackoverflow.com/questions/63342767/command-errored-out-with-exit-status-1-python-setup-py-egg-info-check-the-logs)

---

<div class="post-metadata">

### Author: ![SUPERCAT](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@SUPERCAT](https://forum.codewithmosh.com/u/SUPERCAT)
#### Post date: [August 10, 2022, 11:09am UTC](https://forum.codewithmosh.com/t/error-when-installing-mysqlclient/13665/3 "2022-08-10T11:09:55Z")

</div>

> [@tooTALLtim](#):
>
> python3-dev default-libmysqlclient-dev build-essential

Thanks Ill take a look .

---

<div class="post-metadata">

### Author: ![NAG](https://avatars.discourse-cdn.com/v4/letter/n/43a26b/32.png) [@NAG](https://forum.codewithmosh.com/u/NAG)
#### Post date: [September 13, 2022, 11:43am UTC](https://forum.codewithmosh.com/t/error-when-installing-mysqlclient/13665/4 "2022-09-13T11:43:33Z")

</div>

hey what you type for going that bug ??

---

<div class="post-metadata">

### Author: ![MyselfVijay](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@MyselfVijay](https://forum.codewithmosh.com/u/MyselfVijay)
#### Post date: [September 14, 2022, 4:03am UTC](https://forum.codewithmosh.com/t/error-when-installing-mysqlclient/13665/5 "2022-09-14T04:03:48Z")

</div>

Use the following commands

brew install mysql

brew install openssl

export PATH=${PATH}:/usr/local/mysql/bin/

sudo xcode-select --reset
