3

I'm installing a package through pip, but it fails due to lack of space (IOError: [Errno 28] No space left on device). The only filesystem with lack of space is /dev/sda2. I don't quite understand why it's full or what files are on it, but I purged old kernels to make more space. Apparently it was not enough free space as when I tried to install the package again, it failed.

After the attempted installation less space was available, which makes me think that some files from the attempted installation must still remain in a pip directory. How do I remove these files that are left behind by an attempted installation?

Also removing other unused files in pip directorys would be great. I'm on Linux 14.04.

3 Answers 3

4

In general, pip installs packages in one of the /usr/lib/<python-version>/site-packages/ or /usr/local/lib/<python-version>/dist-packages/ (or lib64 instead of lib) directories (for Ubuntu it should be the second one, I'm guessing that by saying "Linux 14.04" you meant that), and using /tmp or /var/tmp (again, based on your distro) for building packages.

However, pip doesn't have any support for removing files after partial installation, so you need to delete any leftovers manually. Check for pip builds in the temporary directories (you should be able to remove them safely if they are present).

For the actual files from the installation, you can try running pip uninstall <package-name> in hope it catches your partial installations as well (you can use this to remove any package installed via pip). Otherwise, you need to find the relevant files and remove them manually - use something like ls <directory-path> | grep <package-name> to locate them. Note that for the actual removal with rm command, you may need the root access.

It is also possible that the installation added system commands - check for /bin, /usr/bin, /usr/local/bin and other directories and proceed similar to previous point.

2

I don't know if this will help :

sudo apt-get autoremove --purge

I use it frequently to remove unneeded packages that were installed to satisfy dependencies along with their config files. Hope that helps.

1

For python 3.8 on ubuntu 20.04, I found downloaded files in

/home/username/.cache/pip

The downloaded files are retained there even after deleting the venv or removing python3-pip.

New contributor
user7420555 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.