Menu Close

How to install python module that comes with setup.py file?

Not all python module available with pip, or sometimes you need to install a development code to get latest features.

If you searched around, there are blogs and articles guiding user to install them with python setup.py install. Don’t do this!

You should always use pip. Why? Because if you are using `setup.py` as mentioned above, you might have difficulties when you want to uninstall them.

Right way to install

To install, go into the folder containing setup.py then execute this command

$ pip install .

Thats it. You now have it installed and available to use right away.

How to uninstall?

Now you have the module install. How do you uninstall?

Find module name installed

First, you need to find the module name.

List all modules installed and find related module and copy that name

$ pip freeze

You will get something like this

asn1crypto==0.24.0
bencoder.pyx==2.0.1
Brotli==1.0.4
cryptography==2.1.4
decorator==4.1.2
enum34==1.1.6
gssapi==1.4.1
idna==2.6
ipaddress==1.0.17
keyring==10.6.0
keyrings.alt==3.0
lxml==4.3.0
lz4==0.10.1
netifaces==0.10.4
numpy==1.13.3
olefile==0.45.1
paramiko==2.0.0
Pillow==5.1.0
pyasn1==0.4.2
pycairo==1.16.2
pycrypto==2.6.1
pycups==1.9.73
pydns==2.3.6
pygobject==3.26.1
pykerberos==1.1.14
PyOpenGL==3.1.0
python-uinput==0.11.2
pyxdg==0.25
rencode==1.0.5
SecretStorage==2.3.1
setproctitle==1.1.10
six==1.11.0
torf==3.0.0

Let say I want to uninstall torf==3.0.0, I need to copy torf for the uninstallation process

Uninstallation

To uninstall

$ pip uninstall torf

Replace torf with your package name.

After executing the command, you are done.

References

  1. https://stackoverflow.com/questions/1550226/python-setup-py-uninstall
  2. https://stackoverflow.com/questions/1471994/what-is-setup-py

Leave a Reply

Your email address will not be published. Required fields are marked *