When you use
pip to install a package, all the required packages will also be installed with it (dependencies). Does uninstalling that package also remove the dependent packages?
Does uninstalling a package with “pip” also remove the dependent packages?
Each Answer to this Q is separated by one/two green lines.
When you use
You can install and use the pip-autoremove utility to remove a package plus unused dependencies.
# install pip-autoremove pip install pip-autoremove # remove "somepackage" plus its dependencies: pip-autoremove somepackage -y
No, it doesn’t uninstall the dependencies packages. It only removes the specified package:
$ pip install specloud $ pip freeze # all the packages here are dependencies of specloud package
$ pip uninstall specloud $ pip freeze
As you can see those packages are dependencies from
specloud and they’re still there, but not the
specloud package itself.
As mentioned below, You can install and use the pip-autoremove utility to remove a package plus unused dependencies.
i’ve successfully removed dependencies of a package using this bash line:
for dep in $(pip show somepackage | grep Requires | sed 's/Requires: //g; s/,//g') ; do pip uninstall -y $dep ; done
this worked on pip 1.5.4
I have found the solution even though it might be a little difficult for some to carry out.
1st step (for python3 and linux):
pip3 install pip-autoremove
and change all pip(s) to pip3
At least, this was what worked for me …
You may have a try for https://github.com/cls1991/pef.
It will remove package with its all dependencies.