Installing/uninstalling my module with pip

Question:

I am going through the Learn Python the Hard Way, 2nd Edition book, and I am stuck on this problem: “Use your setup.py to install your own module and make sure it works, then use pip to uninstall it.”
If I type

setup.py install

in the command line, I can install the module.

But when I type

pip uninstall setup.py

it says:

Cannot uninstall requirement setup.py, not installed

The pip package index says, http://pypi.python.org/pypi/pip, says:

pip is able to uninstall most installed packages with pip uninstall package-name.

Known exceptions include pure-distutils packages installed with python setup.py install >(such packages leave behind no metadata allowing determination of what files were >installed)

Is there another way to install my module that pip will recognize?

By the way, I’m using a windows computer. Just wanted to mention that in case there are different solutions for Windows, Linux, and Mac.

Asked By: Eva

||

Answers:

You’re giving pip a Python file and not a package name, so it doesn’t know what to do. If you want pip to remove it, try providing the name of the package this setup.py file is actually part of.

There are some good suggestions in this related thread:
python setup.py uninstall

Answered By: kungphu