Uninstall OpenCV 4.2.0 and its Libraries
You uninstall using the same tool you used to install. Simply use 'remove' instead of 'install'. Apt does the cleanup -- proper cleanup is a fundamental job of a package manager.
So based on what you installed:
sudo apt remove libopencv-dev python3-opencv
sudo apt remove libjpeg-dev libpng-dev libtiff-dev
sudo apt autoremove
You don't need to
update
your database of available packages in the repository, since you are removing packages instead of installing.If you want to remove settings files in /etc, use
purge
instead ofremove
.Files in your /home, if any, are NEVER removed by apt. You must delete those yourself.
autoremove
removes orphaned packages, if any. An "orphaned" package is neither explicitly installed by the user nor a dependency of other packages on the system.
Note: These are not magic incantations. Each command in the sequence does something specific. Make sure you understand each command before running it. ALWAYS read and understand the output before agreeing to any changes.
Related videos on Youtube
Ziad El-Massik
Updated on September 18, 2022Comments
-
Ziad El-Massik almost 2 years
I'm quite new to Ubuntu and I just installed opencv and some additional libraries using
sudo apt update
sudo apt install libopencv-dev python3-opencv
sudo apt install libjpeg-dev libpng-dev libtiff-dev
I'm now trying to downgrade from opencv 4.2.0 to opencv 4.1.1.26.
How can I do this?
-
Ziad El-Massik about 3 yearsI'm trying to uninstall opencv 4.2.0 so I can then re-install opencv as version 4.1.1.26. @user535733
-
Ziad El-Massik about 3 yearsIs it not possible to use pip install opencv-python==4.1.1.26 in the case of python 3.8 (After uninstalling the current opencv version, that is)?
-
guiverc about 3 yearsAlso asked at ubuntuforums.org/showthread.php?t=2462486
-
Ziad El-Massik about 3 years@guiverc , that's my question there as well.
-
Ziad El-Massik about 3 yearsThe problem isn't with the installation process but with how to do clean uninstallation of opencv and all opencv related libraries?
-
-
Ziad El-Massik about 3 yearsSo let's say, I had other additional libraries for opencv besides those 3. If I use both purge and remove like this:
sudo apt purge remove libopencv-dev python3-opencv
. Will this remove all those libraries along with opencv or would I have to do something else? -
user535733 about 3 yearsUse apt's
--simulate
flag and see for yourself. -
Ziad El-Massik about 3 yearsI just tested out
sudo apt purge libopencv-dev python3-opencv --simulate
. I later simulatedsudo apt autoremove --simulate
. They showed only the core libopencv libraries being uninstalled. However, the additional libraries were not shown. Is there a way I can purge all the additional libraries without knowing the details of these libraries (their names and how many were installed)? -
user535733 about 3 yearsThat's what
autoremove
is for. Ifautoremove
does not remove anything else, then some other package on your system depends upon those libraries (they are not orphaned). -
Ziad El-Massik about 3 yearsThank you so much for your help. This was very helpful. If you don't mind, I just have one more question. If I uninstall opencv (4.2.0) and reinstall an older version (4.1.1.26) and NOT uninstall the additional libraries, would the additional libraries like libjpeg-dev, work with the older opencv version or would they also have to be uninstalled and reinstalled?
-
user535733 about 3 yearsSome libs will work, some won't. Best practice is to remove all libs for version X, so your version Y install will be clean.