Is cleanup needed after failed pip install?

I accidentally installed pip using the following commands:

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python get-pip.py
Collecting pip
  Downloading https://files.pythonhosted.org/packages/30/db/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e675a1/pip-19.2.3-py2.py3-none-any.whl (1.4MB)
     |████████████████████████████████| 1.4MB 1.3MB/s
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/b2/86/095d2f7829badc207c893dd4ac767e871f6cd547145df797ea26baea4e2e/setuptools-41.2.0-py2.py3-none-any.whl (576kB)
     |████████████████████████████████| 583kB 7.5MB/s
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/00/83/b4a77d044e78ad1a45610eb88f745be2fd2c6d658f9798a15e384b7d57c9/wheel-0.33.6-py2.py3-none-any.whl
Installing collected packages: pip, setuptools, wheel
ERROR: Could not install packages due to an EnvironmentError: [Errno 30] Read-only file system: '/nix/store/96p42644i76jqgdkxjgyl3f0c8n8k16j-python3-3.7.4/lib/python3.7/site-packages/pip'

The installation failed. Is there anything I have to cleanup?

What distro/OS are you using? That process can sometimes have issues if you’re on a OS that includes a preinstalled version of Python. In those cases, I would recommend checking the official repository it uses to see if there’s a python3-pip or similar package to install pip through (if it’s not already installed).

Usually no.

2 Likes

I’m on nixos and have python installed through it.

However I don’t need pip at all for the moment. I just want to make sure some files aren’t left somewhere.

To be a bit more elaborate:

Since the installation failed to even create the first directory, there shouldn’t be anything installed on the system by the script you’ve run. The script could have saved some files in a ~/.cache, but looking at the output, it didn’t cache anything. pip does cleanup after itself pretty well (eg. even deleting temporary directories it makes before exiting).

So… no, I don’t think there’s anything for you to do here manually.


Thanks for reaching out and checking in with us over here! ^>^

2 Likes

So I checked ~/.cache and found the pip directory. I deleted it and rerun python get-pip.py.

The script failed again (like it did initially) and again I was left with ~/.cache/pip. So get-pip.py does indeed leave some files though I wouldn’t consider this a problem since ~/.cache is a folder that people are allowed to remove.

Thank you very much for the help