I had installed a package using Pip. However, when I tried to uninstall it, I got this error:
$ sudo pip uninstall h5py
Can't uninstall 'h5py'. No files were found to uninstall.
You first want to make sure that you are using the pip version that matches the package. That is, if you installed a Python 2.x package, that can only be uninstalled using pip. A Python 3.x package can only be uninstalled using pip3.
In my case, I could not discover the real reason for this error, I resorted to finding the deleting the installed directory for this package. I found the directory
/usr/local/lib/python2.7/dist-packages and deleted that. If this was a Python 3.x package, I would similarly have looked under the
Tried with: Ubuntu 14.04
Development on TrueCrypt has been stopped and so it is a good idea to uninstall TrueCrypt and switch to other alternatives. Since TrueCrypt is not installed from a package, you might have forgotten how to uninstall it.
$ sudo /usr/bin/truecrypt-uninstall.sh
Tried with: TrueCrypt 7.2 and Ubuntu 15.04
If you work with lots of devices in Windows, you are sure to run into problems with device drivers. Sometimes, a particular version of a device driver might cause problems and removing it might be the only solution.
Using Device Manager
This is an easy removal method if you have the device and know that its driver is being used when the device is plugged in. For such a case, plug in the device and open Device Manager. Right-click on the device and choose Properties. In the Driver tab, choose Uninstall.
Using Driver Store Explorer
If you do not have the device or plugging it in causes problems, then the Driver Store Explorer (RAPR) can be used to remove the driver as described here.
Tried with: Windows 7 x64
There are many situations where you need to build an application from source code and install it. The typical method to install it is:
$ sudo make install
One of the major problems with installing like this is that uninstalling is not possible. You will need to know what files were installed to what destination directories and manually remove those files!
The CheckInstall application can be used to convert such an installation into a package, which can be installed and uninstalled easily using your distribution’s package tools.
- Install checkinstall: First, we have to install this application:
$ sudo apt install checkinstall
- Creating a package file: Turning the above
make install into the installation of a package is as easy as:
$ sudo checkinstall
This will take you through some prompts where you provide the meta information for the package. You can choose to just press Enter through these sections. After that, a package file is created and is also installed for you. For example, a
foo_amd64.deb package was created for me and it was installed.
- Package name: Note that the directory name from where you are running this becomes the default package name. If you do not want that, specify a package name:
$ sudo checkinstall --pkgname foobar_by_joe
- Make options: Checkinstall runs
make install by default. If you want other options to be used, that can be accommodated too.
For example, I noticed that checkinstall runs make serially, even though I have specified
-j in my
MAKEFLAGS. So, to explicitly tell checkinstall to build in parallel:
$ sudo checkinstall make -j install
Another example, for another project the install command was
make install_foobar. To use that with checkinstall:
$ sudo checkinstall make install_foobar
- Install your package: I can now use the
.deb file created by checkinstall to install on other computers or pass it to other people on the team:
$ sudo gdebi foo_amd64.deb
- Uninstalling is as easy as:
$ sudo apt remove foo
Tried with: CheckInstall 1.6.2 and Ubuntu 16.04
A lot of Python packages are only available as source code.
To install such a Python package, use its
$ sudo python setup.py install
This will install the Python files to a central location such as
/usr/local/lib. If you do not have such permissions or want to install to a user-local location then try this:
- Create a directory, say
/home/joe/python_libs/lib/python in your home directory to host local Python packages.
- Set the above path in the
PYTHONPATH environment variable.
- Install the package by passing the above path to the
$ python setup.py install --home /home/joe/python_libs
To uninstall a package is tricky.
One solution is to find out where the files were installed and then use that list to remove those files:
$ sudo python setup.py install --record install-files.txt
$ cat install-files.txt | sudo xargs rm -rf
Another solution is to just locate the installation directory, like
/usr/local/lib/python2.7/dist-packages for example and delete the directory of the package.
Tried with: Python 2.7.6 and Ubuntu 14.04