My Java Sir told me to install MySQL-server, workbench, and connector. I did that somehow after spending 30+ hours reading different posts.

After launching Workbench, I went to Tools > Start Shell for MySQL Utilities. Which gave me this popup: https://imgur.com/GQvHKsI

Pressing Download option redirected me to this website: https://imgur.com/ETr2nrY

After installing this package, whenever I run: sudo apt autoremove, I get this error:

pranav@inspiron-5548:~$ sudo apt autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  mysql-connector-python
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 1,362 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 216575 files and directories currently installed.)
Removing mysql-connector-python (8.0.16-1ubuntu19.04) ...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'distutils.sysconfig'
dpkg: error processing package mysql-connector-python (--remove):
 installed mysql-connector-python package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
 mysql-connector-python
E: Sub-process /usr/bin/dpkg returned an error code (1)

So, I thought I should uninstall this, and I used sudo apt-get remove --purge mysql-connector-python command, but it also didn't work, and it throws me the same error as above.

What to do? I am in limbo here! Since any new development done in "mysql-utilities" is aged back to Jan 17, 2017, I don't think I will be needing this anymore. I did the mistake trying to install old archived deb package. (newbie)

IF u know, how to remove it, what is it, it would be really helpful to tell me about it.

Dani AI

Generated

As ’s quick workaround shows, the removal fails because the package’s maintainer script runs Python code that expects the standard distutils module. When that module is missing the script aborts and dpkg leaves the package in a half-removed state. The root cause is a dependency mismatch between the archived .deb and the system Python environment rather than a bug in apt itself.

A cleaner approach is to restore the missing distutils for the interpreter the maintainer script uses, then let the package manager finish removal and repair the package database. For Ubuntu systems this usually means reinstalling the distro package that supplies distutils (Python 3 on modern installs; Python 2 only if the script explicitly targets it):

sudo apt update
sudo apt install --reinstall python3-distutils

If the maintainer script is written for Python 2, install the equivalent Python 2 distutils package instead. After restoring distutils, run the usual package-repair steps (configure unfinished packages and fix broken dependencies) so dpkg/apt can complete the removal.

If restoring distutils is not possible, a last-resort method is to temporarily make the package’s maintainer scripts no-op (for example by inserting a single-line exit 0 at the top), run the removal, then remove the no-op and clean up. Always back up any maintainer script before editing it; editing those scripts should be done only when other fixes fail.

After the broken package is removed, reinstall the connector from a supported source (the distribution repository or the official Python package on PyPI) and avoid installing archived .deb files built for other releases. For long-term stability, consider running a supported Ubuntu release so package dependencies remain available.

Normally, sudo apt autoremove should have worked but in this case, I used this command to the solved issue:

sudo mv /var/lib/dpkg/info/mysql-connector-python*/tmp

After using the above command, use sudo apt autoremove again and that will solve everything.
For more details about this issue, visit this site.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.