Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to cleanly uninstall my python packages with pip3 or any other way?

Tags:

this is my setup.py file for installing my python program, after the installation using python3 setup.py install an entry to my program was created named testmain , when i did pip3 freeze it showed abc==0.1 in its output ,so i uninstalled it using pip3 with pip3 uninstall abc , though the packages were uninstalled but there still existed the entry testmain on my path , is there a way that pip3 also removes this entry during the uninstall or any other way that i can cleanly uninstall my programs under same scenario ?

from setuptools import setup

setup(name='abc',
      version='0.1',
      description='test',
      url='http://github.com/rjdp',
      author='rajdeep',
      author_email='[email protected]',
      license='MIT',
      packages=['cli'],
      install_requires=[
      'cement',
      ],
      entry_points = {
      'console_scripts': ['testmain=cli.abc:main'],
      },
      zip_safe=False)
like image 634
Rajdeep Sharma Avatar asked Mar 30 '15 12:03

Rajdeep Sharma


People also ask

How do I uninstall pip3 packages?

Open a terminal window. To uninstall, or remove, a package use the command '$PIP uninstall <package-name>'.

How do I uninstall all pip packages?

To remove all packages installed by pip with Python, we run pip uninstall . to run pip freeze to get the list of packages installed. And then we pipe that to xargs pip uninstall -y to remove all the packages listed by pip freeze with pip uninstall . We use the -y to remove everything without needing confirmation.

How do I uninstall a package without pip?

You have two options: Use another package manager such as conda . This will only work if the package was originally installed with that package manager. Delete the package manually with File Explorer or the command-line.


1 Answers

Instead of python3 setup.py install use:

pip3 install .

then

pip3 uninstall abc

This will remove testmain.

I had the same question today and spent the entire morning trying to figure out why the script wouldn't uninstall. Nothing worked until I saw Ramana's answer here: https://askubuntu.com/questions/38692/how-does-one-remove-applications-installed-through-python-setup-py-install

"You should always install Python apps with "pip". pip supports uninstall option." and the example in the commment on how local path is supported.

like image 182
William D. Irons Avatar answered Oct 04 '22 22:10

William D. Irons