Is there any way to check/de-cruft/update Python packages installed using pip?
Mats Wichmann
mats at wichmann.us
Tue Dec 29 13:12:53 EST 2020
On 12/29/20 7:48 AM, Chris Green wrote:
> I seem to have quite a lot of old python packages installed over the
> years using pip and would like, if I can. to clear some of them out.
>
>
> Is there any way to tell if a python package was installed by me
> directly using pip or was installed from the [x]ubuntu repositories?
> 'pip list' just tells me every python package that's installed and
> this really isn't much help.
>
>
> Can one uninstall older versions? For example I seem to have
> three versions of Click installed:-
>
> /usr/local/lib/python2.7/dist-packages/click
> /usr/local/lib/python3.7/dist-packages/click
> /usr/lib/python3/dist-packages/click
>
> Presumably the ones in /usr/local have been pulled in as dependencies
> when installing something else using pip, the /usr/lib one has been
> installed from the Ubuntu repositories (again as a dependency). How
> can I remove the ones in /usr/local?
>
>
> If one updates a package using pip will it move it as appropriate from
> (for example) /usr/local/lib/python3.7 to /usr/local/lib/python3.8?
>
>
> Can pip (or some other tool) tell me what other python packages depend
> on one I'm considering uninstalling?
>
>
> If there are any tools/utilities one can install to check these things
> out I'd love to know about them.
There are some tools (on pypi naturally) for fiddling with installed
packages, but for starters try these two:
python -m pip help list
python -m pip help show
show will list dependencies, among other bits of info.
For older versions, you to use the matching version of Python
python2.7 -m pip show click
More information about the Python-list
mailing list