I thought to post this question in Stackoverflow, but I decided to post it here because it probably depends on the OS.
When I install a python package using pip, at the first time it is downloaded from pypi:
pip install numpy
Collecting numpy
Downloading https://files.pythonhosted.org/packages/de/37/fe7db552f4507f379d81dcb78e58e05030a8941757b1f664517d581b5553/numpy-1.15.4-cp27-cp27mu-manylinux1_x86_64.whl (13.8MB)
100% |████████████████████████████████| 13.8MB 792kB/s
Installing collected packages: numpy
Successfully installed numpy-1.15.4
When I uninstall it and reinstall it again, the package is not downloaded. Instead, a cached version is used to install it:
pip install numpy
Collecting numpy
Using cached https://files.pythonhosted.org/packages/de/37/fe7db552f4507f379d81dcb78e58e05030a8941757b1f664517d581b5553/numpy-1.15.4-cp27-cp27mu-manylinux1_x86_64.whl
Installing collected packages: numpy
Successfully installed numpy-1.15.4
Sometimes, the installation get corrupted, or problems occur during the installation. So I need to reinstall the same package again. but since there is a cached version, the re-installation will use the same corrupted version. So I need to delete that cached version in order to do a clean installation.
for that reason, my question is: where are cached python packages stored in Ubuntu?
Thanks to @muru, I found the answer in Stackoverflow. I quote from it:
For Ubuntu, it is located in:
More information can be found in this link