error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Updated 2026-10-02: swapped python-dev for python3-dev and trimmed the lxml packages.

sudo apt-get install python3-dev

Running that command on ubuntu will fix the issue.

If you’re installing lxml:

Also try this:

sudo apt-get install libxslt1-dev libxml2-dev libssl-dev