Search code examples
pythonpipanacondaconda

Pip: unistall ALL pkgs installed during `-e` installation


I just installed a github repo with -e .; That's what I intended to do, only I didn't notice I was in my base conda env rather than in the intended environment.

That package, in turn, installed a sh*tload of dependencies (like something north of ~20 Gb). Now, I'm in need of uninstalling all that stuff. Is there a way to tell pip to do that without breaking my conda base env? I was thinking.. Is there a log of installed pkgs *with timestamps` so that I can tell pip to remove all the stuff installed from a certain date onwards?


Solution

  • There is no such record, unless you invoked pip with file logging or still have the terminal scrollback available.

    You could check the times of the site-packages subdirectories, for example if pip has installed foo==1.0 then you will find a file like:

    /path/to/installenv/lib/python3.XY/site-packages/foo-1.0.dist-info/INSTALLER
    

    The mtime of this file should be the install time.

    However, this method is not 100% reliable because it is possible that pip needed to upgrade a dependency which was already installed, in which case uninstalling it completely would leave an unsatisfied dependency in your env. You would need to downgrade to what was there previously, and that information is only in the pip log (which is only logged to terminal by default).

    My recommendation is to destroy and recreate your conda base env.