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.
sudo apt update
and then post the output ofapt-cache policy libmysqlclient-dev libmysqlclient20
. – fkraiem May 08 '19 at 12:42bionic-updates
andbionic-security
. – fkraiem May 08 '19 at 13:08