# Error while installing mysqlclient with pipenv

**URL:** <https://forum.codewithmosh.com/t/error-while-installing-mysqlclient-with-pipenv/19630>\
**Category:** Django\
**Created:** [April 17, 2023, 5:27am UTC](https://forum.codewithmosh.com/t/error-while-installing-mysqlclient-with-pipenv/19630 "2023-04-17T05:27:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nevillebrem](https://avatars.discourse-cdn.com/v4/letter/n/13edae/32.png) [@nevillebrem](https://forum.codewithmosh.com/u/nevillebrem)\
**Post date:** [April 17, 2023, 5:27am UTC](https://forum.codewithmosh.com/t/error-while-installing-mysqlclient-with-pipenv/19630/1 "2023-04-17T05:27:41Z")

</div>

this is what my console is saying:  
I am on an M1 Mac Mini with the latest MacOS Ventura

```auto
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
Installing mysqlclient...
Resolving mysqlclient...
Installing...
⠦ Installing mysqlclient...[31m[1mError: [0m An error occurred while installing [32mmysqlclient[0m!
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'

[36m error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [18 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 "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/m7/pz85l0hx3pn00v5n75y8src00000gn/T/pip-install-9yuloskm/mysqlclient_cf51d021f9144dcfaf02fede6e5dd224/setup.py", line 15, in <module>
          metadata, options = get_config()
                              ^^^^^^^^^^^^
        File "/private/var/folders/m7/pz85l0hx3pn00v5n75y8src00000gn/T/pip-install-9yuloskm/mysqlclient_cf51d021f9144dcfaf02fede6e5dd224/setup_posix.py", line 70, in get_config
          libs = mysql_config("libs")
                 ^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/m7/pz85l0hx3pn00v5n75y8src00000gn/T/pip-install-9yuloskm/mysqlclient_cf51d021f9144dcfaf02fede6e5dd224/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
      
  
  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.
[0m
This is likely caused by a bug in [32mmysqlclient[0m. Report this to its maintainers.
✘ Installation Failed

```

---

<div class="post-metadata">

**Author:** ![blitzoc](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@blitzoc](https://forum.codewithmosh.com/u/blitzoc)\
**Post date:** [April 19, 2023, 9:26am UTC](https://forum.codewithmosh.com/t/error-while-installing-mysqlclient-with-pipenv/19630/2 "2023-04-19T09:26:52Z")

</div>

check my post here:

> [@Issue with installing MySQL on ubunto](https://forum.codewithmosh.com/t/issue-with-installing-mysql-on-ubunto/19481/2):
>
> had problems as well. here i found a solution: [python - Python3 - Pipenv install mysqlclient? - Stack Overflow](https://stackoverflow.com/questions/50604948/python3-pipenv-install-mysqlclient) you have to do the following first: sudo apt install libmysqlclient-dev after having done this also: pipenv install worked, where it was possible to lock the pipfile. before that i always got an error.

i am working on ubuntu and needed to install another package (libmysqlclient-dev) first.  
afterwards it was resolved.

Cheers

---

<div class="post-metadata">

**Author:** ![Kolden](https://avatars.discourse-cdn.com/v4/letter/k/f1d935/32.png) [@Kolden](https://forum.codewithmosh.com/u/Kolden)\
**Post date:** [June 22, 2023, 6:24pm UTC](https://forum.codewithmosh.com/t/error-while-installing-mysqlclient-with-pipenv/19630/3 "2023-06-22T18:24:36Z")

</div>

I am on macOS Monterey v12.6.7. After using brew to install mysqlclient and mysql. All I had to do to fix this issue was use this command:

```auto
brew install mysql-client pkg-config

```
