2

I have mysql 8.0.29 installed. But I have issues installing mysqlclient with python3 -m pip install mysqlclient:

Defaulting to user installation because normal site-packages is not writeable
Collecting mysqlclient
  Using cached mysqlclient-2.1.0.tar.gz (87 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      /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 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-31jc6lbk/mysqlclient_7f61ec1e458e4a469fd88d02fd7b717e/setup.py", line 15, in <module>
          metadata, options = get_config()
        File "/tmp/pip-install-31jc6lbk/mysqlclient_7f61ec1e458e4a469fd88d02fd7b717e/setup_posix.py", line 70, in get_config
          libs = mysql_config("libs")
        File "/tmp/pip-install-31jc6lbk/mysqlclient_7f61ec1e458e4a469fd88d02fd7b717e/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.

I tried running sudo apt-get install python3-dev default-libmysqlclient-dev build-essential as said here: https://pypi.org/project/mysqlclient/. But got another error:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libssl-dev : Depends: libssl3 (= 3.0.2-0ubuntu1.1) but 3.0.2-0ubuntu1.2 is to be installed
E: Unable to correct problems, you have held broken packages.

Also, earlier I could find a way to resolve this problem in stackoverflow by installing some software from mysql website and it worked for me. But I had to reinstall ubuntu for various reasons. And now I can't find that stackoverflow post. Thanks!

aboka
  • 65
  • 1
  • 7

0 Answers0