4

I tried to uninstall codeblocks from ubuntu software. After clicking remove it's showing "Unable to remove code::blocks IDE. No packages to remove"

I tried another way, by running sudo apt-get purge codeblocks in terminal. But it's showing

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 codeblocks-contrib : Depends: libboost-system1.62.0 but it is not installable
                      Depends: libhunspell-1.4-0 but it is not installable
                      Depends: libwxgtk3.0-0v5 (>= 3.0.2+dfsg) but it is not installable
                      Depends: libwxsmithlib0 (= 20.03) but 20.03-3 is to be installed
                      Depends: codeblocks (= 20.03) but it is not going to be installed
                      Recommends: valgrind but it is not going to be installed
                      Recommends: cppcheck but it is not going to be installed
                      Recommends: cscope but it is not going to be installed
                      Recommends: cccc but it is not going to be installed
 codeblocks-dev : Depends: libcodeblocks0 (= 20.03) but 20.03-3 is to be installed
 codeblocks-libwxcontrib0 : Depends: libwxgtk3.0-0v5 (>= 3.0.2+dfsg) but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

How to uninstall codeblocks?


after running dpkg -l | grep codeblocks

iU  codeblocks                                 20.03-3                               amd64        Code::Blocks integrated development environment (IDE)
iU  codeblocks-common                          20.03-3                               all          common files for Code::Blocks IDE
iU  codeblocks-contrib                         20.03                                 amd64        contrib plugins for Code::Blocks IDE
ii  codeblocks-contrib-common                  20.03                                 all          common files for the contrib plugins for Code::Blocks IDE
iU  codeblocks-dev                             20.03                                 amd64        Code::Blocks development libraries (SDK)
ii  codeblocks-headers                         20.03                                 all          Code::Blocks development headers (SDK)
iU  codeblocks-libwxcontrib0                   20.03                                 amd64        Code::Blocks shared libraries for wxContribItems
iU  codeblocks-libwxcontrib0-dbgsym            20.03                                 amd64        Debug symbols for codeblocks-libwxcontrib0
iU  codeblocks-wxcontrib-dev                   20.03                                 amd64        Code::Blocks development libraries for wxContribItems
iU  codeblocks-wxcontrib-headers               20.03                                 all          Code::Blocks development headers for wxContribItems
iU  libcodeblocks0                             20.03-3                               amd64        Code::Blocks shared library

1 Answers1

5

The packages available for download are the Debian version. These are incompatible on Ubuntu because of conflicting files. Codeblocks is available from the default Universe repository on Ubuntu (version 20.03-3). Also, the Ubuntu packages were consolidated into a handful of packages so there's no need to download anything extra.

First, uninstall the debian codeblocks packages using the following command:

sudo dpkg -P $(dpkg -l | grep codeblocks | awk '{print $2}') libwxsmithlib0 libwxsmithlib0-dev wxsmith-dev wxsmith-headers

Then, run the following commands to update your package list and reinstall codeblocks from the Ubuntu repositories:

sudo add-apt-repository universe
sudo apt update
sudo apt install --reinstall $(apt-cache search codeblocks | awk '{print $1}')

To explain the commands used, the following command searches for and lists packages related to codeblocks:

apt-cache search codeblocks

The first column (on the left) lists the package names. So, to list only the package names, we can use awk to print only the first column which is represented by $1 like this:

apt-cache search codeblocks | awk '{print $1}'

To insert the output of that command into another command, we can use $(). So to install the packages listed by the command above, we can use the following command:

sudo apt install --reinstall $(apt-cache search codeblocks | awk '{print $1}')

Additional help:

To search for available packages, you can use apt-cache search like this:

apt-cache search codeblocks

To filter the results to only include results that contain the word "codeblocks", we can use the grep command like this:

apt-cache search codeblocks | grep -i codeblocks

For more information about a specific package, we can use the apt-cache show command like this:

apt-cache show codeblocks

To list all installed packages, we can use dpkg -l and filter the results like this:

dpkg -l | grep codeblocks

Click here for more info about dpkg status codes (e.g., ii, iU, etc.). Basically, ii means fully installed and iU means that the package is not fully installed.

mchid
  • 43,546
  • 8
  • 97
  • 150
  • I tried to uninstall using ur cmd. but it's showing `dependency problems prevent removal of codeblocks: codeblocks-contrib depends on codeblocks (= 20.03); however: Package codeblocks is to be removed.

    dpkg: error processing package codeblocks (--purge): dependency problems - not removing Errors were encountered while processing: codeblocks `

    – Pronay Sarker May 13 '21 at 15:14
  • 1
    @PronaySarker Okay, I updated the instructions. – mchid May 15 '21 at 00:31
  • Big thanks for the guide. My Code::Blocks installation was a disaster and you saved the day. By the way, it's sudo add-apt-repository universe. – CaTx Dec 26 '22 at 06:21