How remove a program installed with distutils?

2024/10/9 14:20:57

I have installed a python application with this setup.py:

#!/usr/bin/env pythonfrom distutils.core import setup
from libyouandme import APP_NAME, APP_DESCRIPTION, APP_VERSION, APP_AUTHORS, APP_HOMEPAGE, APP_LICENSEsetup(name=APP_NAME.replace(" ","-").lower(),version=APP_VERSION,description=APP_DESCRIPTION,author="John G",author_email="[email protected]",url=APP_HOMEPAGE,license=APP_LICENSE,scripts=["youandme.py"],packages=["libyouandme"],data_files=[('share/applications', ['youandme.desktop']),('usr/share/icons/hicolor/16x16/apps', ['icons/hicolor/16x16/apps/you.png']),('usr/share/icons/hicolor/22x22/apps', ['icons/hicolor/22x22/apps/you.png']),('usr/share/icons/hicolor/48x48/apps', ['icons/hicolor/48x48/apps/you.png'])],
)

How can I remove this application from my ubuntu machine ?

Do I can do this with distutils ?

Answer

Install the checkinstall Ubuntu package. checkinstall monitors the installation procedure and creates a deb package. This lets you use regular package management commands to remove the software.

First, reinstall the candidate python module/package using checkinstall. Change directory to the directory containing the setup.py file of the candidate python module/package:

cd <PACKAGE_NAME>

Then:

sudo checkinstall -D --fstrans=no python setup.py install

This creates a .deb package, and installs the python module again. You'll be asked a few questions. The default answers should be fine. (But you might change the "name" of the .deb package, when the setup.py file is in a subdirectory of the python module, for example the "source" subdirectory.)

(The saved .deb package now captures how the python package installed itself, and dpkg can remove the python package.)

Then immediately remove the module:

sudo dpkg -r <PACKAGE_NAME>

PS. I've heard that some installation programs are not compatible with checkinstall, though I've never run into any problems myself.

https://en.xdnf.cn/q/70013.html

Related Q&A

How to check which line of a Python script is being executed?

Ive got a Python script which is running on a Linux server for hours, crunching some numbers for me. Id like to check its progress, so Id like to see what line is being executed right now. If that was …

input to C++ executable python subprocess

I have a C++ executable which has the following lines of code in it /* Do some calculations */ . . for (int i=0; i<someNumber; i++){int inputData;std::cin >> inputData;std::cout<<"T…

pandas extrapolation of polynomial

Interpolating is easy in pandas using df.interpolate() is there a method in pandas that with the same elegance do something like extrapolate. I know my extrapolation is fitted to a second degree polyno…

Speed-up a single task using multi-processing or threading

Is it possible to speed up a single task using multi-processing/threading? My gut feeling is that the answer is no. Here is an example of what I mean by a "single task":for i in range(max):p…

Full outer join of two or more data frames

Given the following three Pandas data frames, I need to merge them similar to an SQL full outer join. Note that the key is multi-index type_N and id_N with N = 1,2,3:import pandas as pdraw_data = {type…

How can I add a level to a MultiIndex?

index = [np.array([foo, foo, qux]),np.array([a, b, a])] data = np.random.randn(3, 2) columns = ["X", "Y"] df = pd.DataFrame(data, index=index, columns=columns) df.index.names = [&qu…

decoupled frontend and backend with Django, webpack, reactjs, react-router

I am trying to decouple my frontend and my backend in my project. My frontend is made up of reactjs and routing will be done with react-router, My backend if made form Django and I plan to use the fron…

Map colors in image to closest member of a list of colors, in Python

I have a list of 19 colors, which is a numpy array of size (19,3):colors = np.array([[0, 0, 0], [0, 0, 255], [255, 0, 0], [150, 30, 150], [255, 65, 255], [150, 80, 0], [170, 120, 65], [125, 125,…

Storing a file in the clipboard in python

Is there a way to use the win32clipboard module to store a reference to a file in the windows clipboard in python. My goal is to paste an image in a way that allows transparency. If I drag and drop a…

retrieve intermediate features from a pipeline in Scikit (Python)

I am using a pipeline very similar to the one given in this example : >>> text_clf = Pipeline([(vect, CountVectorizer()), ... (tfidf, TfidfTransformer()), ... …