'PyCups Failed building wheel for pycups on Raspberry Pi

I'm trying to install pycups on my raspberry pi running Python 2.7.16 and pip version 18.1. I'm trying to install with the following command:

sudo pip install pycups

But it keeps failing and giving this error:

Failed building wheel for pycups
Running setup.py clean for pycups
Failed to build pycups

Any ideas what could be wrong and how I can install pycups on my Pi?

I've tried

sudo pip install -U setuptools

and

sudo apt-get install python-dev

And both say they are up-to-date



Solution 1:[1]

Given that Python 2 reached it's end of life in 2020/01/01, pycups 2.0 and later require Python 3.

If you already have Python 3 installed, you may run the command as

pip3 install pycups

The same applies to python, becoming python3 to disambiguate.

Note that the dependencies also change:

sudo apt install gcc python3-dev libcups2-dev

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Guilherme Gonzaga