0

I'm trying to install mysqlclient in a Python 3.6 environment on Ubuntu 16.04 using the recommended $ pip install mysqlclient. This produces an error OSError: mysql_config not found. I don't know what this mysqlclient file is, but I verified that it doesn't exist on my system.

Ubuntu Package Search tells me that the file /usr/bin/mysql_config is provided by the packages libmariadb-dev-compat, libmariadbclient-dev, and libmysqlclient-dev. Since I'm using MySQL and not MariaDB, I try to install libmysqlclient-dev through apt-get. It fails with the error

The following packages have unmet dependencies:
libmysqlclient-dev : Depends: libmysqlclient20 (= 5.7.21-1ubuntu1) but 5.7.24-0ubuntu0.18.04.1 is to be installed 
E: Unable to correct problems, you have held broken packages.

I have version 5.7.24-0ubuntu0.18.04.1 of libmysqlclient20 already installed on the system, but libmysqlclient-dev is set to depend on version 5.7.21-1ubuntu1 exactly. Can mysqlclient not be installed on Ubuntu 18.04? If it can, how do I resolve this and install libmysqlclient-dev?

Also, what does it mean that I "have held broken packages"? Is there a way to determine which package is broken and what's broken about it?

Edit I performed apt-get update and apt-get upgrade multiple times while trying to troubleshoot this myself, and I just did so again to be sure.

Here is the output of apt-cache policy libmysqlclient-dev libmysqlclient20:

$ apt-cache policy libmysqlclient-dev libmysqlclient20
libmysqlclient-dev:
  Installed: (none)
  Candidate: 5.7.21-1ubuntu1
  Version table:
     5.7.21-1ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
libmysqlclient20:
  Installed: 5.7.24-0ubuntu0.18.04.1
  Candidate: 5.7.24-0ubuntu0.18.04.1
  Version table:
 *** 5.7.24-0ubuntu0.18.04.1 100
        100 /var/lib/dpkg/status
     5.7.21-1ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

EDIT 2 According to my notes, on 2Dec2018 I added the line

deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

to my /etc/apt/sources.list to solve a similar problem, because for some reason unknown to me it wasn't there already. Checking the file now, the line was not there. I am 100% certain that I never knowingly removed it.

How the hell does this keep happening? What package or program has the ability to edit my sources.list for me? I never use any graphical package management system, only apt-get from the command line, and I've never knowingly altered my sources after install except in these specific instances.

EDIT 3 Re-adding the line

deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

to /etc/apt/sources.list worked. I was able to update and then install libmysqlclient-dev, and /usr/bin/mysql_config now exists on my system. I still can't install mysqlclient, but now it's because of a completely different missing file. Just another lost day of productivity in the ongoing saga of trying to accomplish something using this shitstain open source software, and at least one more lost day to come.

  • 1
    Looks like a classic case of out-of-date sources... Run sudo apt update and then post the output of apt-cache policy libmysqlclient-dev libmysqlclient20. – fkraiem May 08 '19 at 12:42
  • @fkraiem Done, question edited with the output – Darien Marks May 08 '19 at 12:50
  • Yep, you don't seem to have enabled bionic-updates and bionic-security. – fkraiem May 08 '19 at 13:08
  • @fkraiem I think this is the second time this has happened to me on this system. I've never knowingly in my life disabled the updates and security repositories, do you have any educated guess about how they keep getting disabled? – Darien Marks May 08 '19 at 13:14
  • Not really, sorry. This has never happened to me, but I never use graphical tools for package management (also, I use Kubuntu on desktops instead of regular Ubuntu). – fkraiem May 08 '19 at 13:27
  • 1
    The text of the question mentions 16.04, but tag and title refer to 18.04. Something is wrong & needs clarification/change. – guiverc May 08 '19 at 14:13

0 Answers0