running out of disc space when you're not in python

The most likely cause is lack of space in /tmp. The workaround is to instruct pip to use an alternative folder. I use the following formulation:

TMPDIR=/home/user/tmp/ python3 -m pip install a_package