I installed package into specific local directory using pip install -t <dir>
.
Now I want to uninstall it, but I cannot find a way to uninstall from that specific directory. For uninstall
there is no valid option -t | --target, which exists for install
command.
pip does not keep hidden directories of installed packages and scans directories such as /usr/local/lib/python2. 7/dist-packages directly to determine what is installed. To uninstall it, just go into localpips and delete the files and directories that were created.
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 .
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.
Remove them manually. pip
does not keep hidden directories of installed packages and scans directories such as /usr/local/lib/python2.7/dist-packages
directly to determine what is installed.
So, if you installed something using -t
just go to the directory you specified and delete all traces, including any metadata files. For example,
$ mkdir localpips
$ pip install -t localpips docopt
Downloading/unpacking docopt
Downloading docopt-0.6.2.tar.gz
Running setup.py (path:/tmp/pip_build_garyw/docopt/setup.py) egg_info for package docopt
Installing collected packages: docopt
Running setup.py install for docopt
Successfully installed docopt
Cleaning up...
$ cd localpips
$ ls -l
total 48
drwxr-xr-x 2 garyw garyw 4096 Jul 6 17:27 docopt-0.6.2.egg-info
-rw-r--r-- 1 garyw garyw 19946 Jul 6 17:27 docopt.py
-rw-r--r-- 1 garyw garyw 23326 Jul 6 17:27 docopt.pyc
$
To uninstall it, just go into localpips
and delete the files and directories that were created.
I know, it's not that elegant, and sometimes you have no idea what may be related to what if you didn't observe the install carefully, but that's the way it is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With