"command 'gcc' failed" when trying to install a Python package from pypi

Your system is missing the Python headers. To fix this, run

sudo apt-get install python-dev

or

sudo apt-get install python3-dev