Uninstall OpenCV 3.0.0 from Ubuntu14.04 - c++

I want to use surffeature with opencv3.0.0 on Ubuntu, but I didn't install opencv_contrib at first. When I tried to install opencv_contrib, it failed. So I intend to uninstall opencv3.0.0, and reinstall it with opencv_contrib. I just delete the build file which was built during the installing opencv3.0.0. Then I type :
make uninstall
in terminal. It failed again, the error information is :
CMake Error at cmake_uninstall.cmake:20 (MESSAGE): Problem when
removing "/usr/local/include/opencv2/cvconfig.h"
I found I should type :
make uninstall
instead of remove build file, but it's already done.
I installed opencv3.0.0 with the following instruction
sudo apt-get install build-essential
sudo apt-get install git libgtk2.0-dev libavcodec-dev libavformat-dev libtiff4-dev libswscale-dev libjasper-dev
sudo apt-get install pkg-config
cmake .
mkdir build
cd build
cmake -D WITH_IPP=OFF ..
make ..
sudo make install
cd /etc/ld.so.conf.d
sudo /bin/bash -c 'echo "/usr/local/lib" /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig -v
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
What should I do now ?

You have to use sudo, as the file belongs to the system and you don't have access to it by default.
Try:
sudo make uninstall
It worked for me.

I delete all the opencv files, including source file and installed file under /usr/local, finally re-install opencv

Related

Is there easy way to include xlnt to Visual Studio Code on Ubuntu?

I want to use xlnt library to edit xlsx data but i don't know how to input this to global libraries of VSC. Could you please tell me step by step how install this library?
https://github.com/tfussell/xlnt
You need some packages firstly:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install cmake
sudo apt-get install zlibc
The following steps update the compiler and set the appropriate environment variables:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt-get upgrade
sudo apt-get install gcc-6 g++-6
export CC=/usr/bin/gcc-6
export CXX=/usr/bin/g++-6
The following steps will intall xlnt Download the zip file from the xlnt repository:
cd ~
unzip Downloads/xlnt-master.zip
cd xlnt-master
cmake .
make -j 2
sudo make install
The following step will map the shared library names to the location of the corresponding shared library files:
sudo ldconfig
xlnt will now be ready to use on your Ubuntu instance.
source

Compiling C++ Paho MQTT code gives error "Could not find Paho MQTT C library"

I'm using Ubuntu 16.04, I cloned the c library at ~/Paho_MQTT/paho_c and ran following commands in paho.mqtt.c folder,
sudo apt-get install build-essential gcc make cmake cmake-gui cmake-curses-gui
sudo apt-get install fakeroot fakeroot devscripts dh-make lsb-release
sudo apt-get install libssl-dev
sudo apt-get install doxygen graphviz
mkdir build
cd build
ccmake ..
make
sudo make install
All goes well.
Then I cloned c++ code at ~/Paho_MQTT/paho_cpp, and ran following commands in the paho.mqtt.cpp folder,
mkdir build
cd build
cmake -DPAHO_MQTT_C_PATH=~/Paho_MQTT/paho_c/paho.mqtt.c ..
Here I get error, "Could not find Paho MQTT C library",
Can you please suggest any solution ?

How to uninstall python in ubuntu completely and reinstalling it?

The default python version was 2.7.12 in ubuntu.
I installed python2.7.13 using the below commands.
Then download using the following command:
version=2.7.13
cd ~/Downloads/
wget https://www.python.org/ftp/python/$version/Python-$version.tgz
Extract and go to the directory:
tar -xvf Python-$version.tgz
cd Python-$version
Now, install using the command you just tried, using checkinstall instead to make it easier to uninstall if needed:
./configure
sudo make install
Now there is some issue in pandas(giving no module named pandas when I try to import but if we try to install it shows required already satisfied) so I want to completely remove python 2.7.13 and reinstall python 2.7.12. How can I achieve this?
My python was corrupted due to some module. So I planned to re-installed or remove the python completely from my Ubuntu 16.04 machine. But sudo apt-get install --reinstall python2.7 command was also failing and was throwing same error. So I finally Did few hacks and cracks. Here are the steps -
Removing all python version manually
- sudo rm -rf /usr/bin/python2.x as well as python3.x
- sudo rm -rf /usr/lib/python2.x as well as python3.x
- sudo rm -rf /usr/local/lib/python2.x as well as python 3.x
Updating Ubuntu
- sudo apt-get update
In Between if you get this error The package needs to be reinstalled ubuntu Then Run following command
sudo vi /var/lib/dpkg/status
And delete all the lines from above file for the package which was expecting re-install and run sudo apt-get update again.
Now download a python tgz file from https://www.python.org/downloads/ and unzip it and CD into it
./configure
make test
sudo make install
Python should be installed now. Check by running python

Installing OpenCV with GUI on Ubuntu

It seems that I have messed things up. I forgot to install some dependencies of OpenCV on Ubuntu. To be specific, I want to install OpenCV on Ubuntu 14.04 with GUI support. I noticed that there is a package named gtk+-2.0 which is required by OpenCV. So I did
sudo apt-get install libgtk2.0-dev
or some thing like that. It installed alright. I also installed other dependencies specified here.
However, when I run cmake according to the tutorial, it says that
gtk+-2.0` not found
so OpenCV will be built without GUI support. Is there any environmental variable that I should set before I run cmake?
I can detect gtk+-2.0 by
pkg-config --modversion gtk+-2.0`
which outputs 2.24.23. Also, I remember adding some search path for gtk+-2.0, some thing like
/usr/lib/x86_64-linux-gnu/pkgconfig
Is there anything to do with this?
Thanks.
install dependencies
sudo apt-get install build-essential checkinstall cmake pkg-config yasm
sudo apt-get install libtiff4-dev libjpeg-dev libjasper-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev
sudo apt-get install python-dev python-numpy
sudo apt-get install libtbb-dev
sudo apt-get install libqt4-dev libgtk2.0-dev
sudo wget
http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip
unzip opencv-2.4.9.zip
cd opencv-2.4.9
mkdir build
cd build sudo cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D
BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_VTK=ON
sudo make
sudo make install
My suggestion is to clean up the build environment before continuing. make clean will not be sufficient. Remove all makefiles and start all over again.
I have just successfully installed OpenCV and ran a video file on Ubuntu 16.04 LTS. Let me know if I can be of further assistance.

Uninstall boost and install another version

I've installed the boost libraries on Linux Mint 12 using the command sudo apt-get install libboost-dev libboost-doc, which installs the default version available in the repositories. However, the project I have to do needs the 1.44 version of boost. How do I uninstall the default (current) version 1.46 and install 1.44?
I couldn't find the documentation on the boost website to install boost from the .tar.gz package.
Boost can installed by two ways
Deb package
wget and install manually
In some case we might have installed by both type which can cause version error. Lets see how to uninstall both.
sudo apt-get update
# to uninstall deb version
sudo apt-get -y --purge remove libboost-all-dev libboost-doc libboost-dev
# to uninstall the version which we installed from source
sudo rm -f /usr/lib/libboost_*
Then we need to install other dependencies if they are not met
sudo apt-get -y install build-essential g++ python-dev autotools-dev libicu-dev libbz2-dev
Lets download the boost version which we need from the link. I am downloading the 1.54 version. Then untar and install it.
# go to home folder
cd
wget http://downloads.sourceforge.net/project/boost/boost/1.54.0/boost_1_54_0.tar.gz
tar -zxvf boost_1_54_0.tar.gz
cd boost_1_54_0
# get the no of cpucores to make faster
cpuCores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}'`
echo "Available CPU cores: "$cpuCores
./bootstrap.sh # this will generate ./b2
sudo ./b2 --with=all -j $cpuCores install
Now let's check the installed version
cat /usr/local/include/boost/version.hpp | grep "BOOST_LIB_VERSION"
You will see something like below
// BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION
#define BOOST_LIB_VERSION "1_54"
Version 1.54 of boost is installed
That's it, it worked for me. Let me know if you face any issues.
You can uninstall with
apt-get --purge remove libboost-dev libboost-doc
Download the package you need from boost website, extract and follow "getting started" instructions found inside index.html in the extracted directory.
Tested working Ubuntu 20.04 Use my script to uninstall your older version of boost in ubuntu 20.04 and follow rams instructions above
#!/bin/bash
sudo apt-get -y --purge remove libboost-all-dev libboost-doc libboost-dev
echo "clear boost dir"
sudo rm -r /usr/local/lib/libboost*
sudo rm -r /usr/local/include/boost
sudo rm -r /usr/local/lib/cmake/*
sudo rm -f /usr/lib/libboost_*
sudo rm -r /usr/include/boost
Downgrade your boost version. I'm not familiar with Mint, but assuming it is deb-based, you can do:
apt-cache show libboost-dev
to see all installable version and install a specific version with
sudo apt-get install libboost-dev=1.42.0.1
There are also convenience packages for the major boost versions:
sudo apt-get install libboost1.44-dev
As #savamane wrote you can uninstall it with
apt-get --purge remove libboost-dev libboost-doc
Another suggestion to install the .deb packages as suggested here. (Download the one fitted for your architecture though).
For still supported distros, you can simply search for the package at the distributions at http://packages.ubuntu.com/. For example libboost-system1.46.1 can be found in under the precise -> Libraries tab.
For unsupported distros, there is still a chance to find them at
http://archive.ubuntu.com/. For example can libboost-all-dev_1.40.0.1_amd64.deb be found in
http://archive.ubuntu.com/ubuntu/pool/universe/b/boost-defaults/.
This is how you install a specific Boost version:
cd boost_1_54_0/
./bootstrap.sh --with-libraries=atomic,date_time,exception,filesystem,iostreams,locale,program_options,regex,signals,system,test,thread,timer,log
sudo ./b2 install