MySQL-python can't install with container circleci/python:2.7.16

My build works with the following using docker container circleci/python:2.7.15

Build-agent version 1.0.12069-0bafdb01 (2019-07-05T21:14:34+0000)
Docker Engine Version: 18.09.6
Kernel Version: Linux 3031adb5a498 4.15.0-1035-aws #37-Ubuntu SMP Mon Mar 18 16:15:14 UTC 2019 x86_64 Linux
Starting container circleci/python:2.7.15
  image is cached as circleci/python:2.7.15, but refreshing...
2.7.15: Pulling from circleci/python
Digest: sha256:a31c3ce5ecff5a45790a8cd151ffad362b4996f5d102269a4d5484ff3c75cd5c
Status: Image is up to date for circleci/python:2.7.15
  using image circleci/python@sha256:a31c3ce5ecff5a45790a8cd151ffad362b4996f5d102269a4d5484ff3c75cd5c

But will not work with circleci/python:2.7.16

Build-agent version 1.0.12069-0bafdb01 (2019-07-05T21:14:34+0000)
Docker Engine Version: 18.09.6
Kernel Version: Linux 46d76fe6dcb4 4.15.0-1043-aws #45-Ubuntu SMP Mon Jun 24 14:07:03 UTC 2019 x86_64 Linux
Starting container circleci/python:2.7.16
  image cache not found on this host, downloading circleci/python:2.7.16
2.7.16: Pulling from circleci/python
Digest: sha256:d6d71dbac1d5d03351af518caee7fc3ccf016d4050de80b4b931ff2591e6ac6a
Status: Downloaded newer image for circleci/python:2.7.16
  using image circleci/python@sha256:d6d71dbac1d5d03351af518caee7fc3ccf016d4050de80b4b931ff2591e6ac6a

Erroring with the following while installing MySQL-python

e, ipaddress, text-unidecode, Faker, singledispatch, tornado, flower, jdcal, jsonfield, lxml, funcsigs, pbr, mock, MySQL-python, mysql, newrelic, numpy, openpyxl, Pillow, raven, slackclient, zope.interface, Twisted, unittest-xml-reporting, requests-toolbelt, humanyze-client, django-managedbeat
Running setup.py install for MySQL-python … - error
ERROR: Complete output from command /home/circleci/Humanyze/wyze/src/venv/bin/python -u -c β€˜import setuptools, tokenize;file=β€™β€œ'β€β€˜/tmp/pip-install-tj_Uqm/MySQL-python/setup.pyβ€™β€œ'β€β€˜;f=getattr(tokenize, β€˜"β€™β€œβ€˜openβ€™β€β€™β€œβ€˜, open)(file);code=f.read().replace(β€™β€β€˜"’\r\nβ€™β€œ'β€β€˜, β€˜"’"’\nβ€™β€œ'β€β€˜);f.close();exec(compile(code, file, β€˜"β€™β€œβ€˜execβ€™β€β€™β€œβ€˜))’ install --record /tmp/pip-record-ipvpL6/install-record.txt --single-version-externally-managed --compile --install-headers /home/circleci/Humanyze/wyze/src/venv/include/site/python2.7/MySQL-python:
ERROR: running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying mysql_exceptions.py β†’ build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/init.py β†’ build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py β†’ build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py β†’ build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py β†’ build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py β†’ build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py β†’ build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/init.py β†’ build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py β†’ build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py β†’ build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py β†’ build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py β†’ build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py β†’ build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py β†’ build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building 'mysql’ extension
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,5,β€˜final’,1) -D__version
=1.2.5 -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I/usr/local/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
In file included from _mysql.c:44:
/usr/include/mariadb/my_config.h:3:2: warning: #warning This file should not be included by clients, include only <mysql.h> [-Wcpp]
#warning This file should not be included by clients, include only <mysql.h>
^~~~~~~
In file included from _mysql.c:46:
/usr/include/mariadb/mysql.h:440:3: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
MYSQL_CLIENT_PLUGIN_HEADER
^~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c: In function β€˜_mysql_ConnectionObject_ping’:
_mysql.c:2005:41: error: β€˜MYSQL’ {aka β€˜struct st_mysql’} has no member named β€˜reconnect’
if ( reconnect != -1 ) self->connection.reconnect = reconnect;
^
error: command β€˜gcc’ failed with exit status 1
----------------------------------------
ERROR: Command β€œ/home/circleci/Humanyze/wyze/src/venv/bin/python -u -c β€˜import setuptools, tokenize;file=’”'β€β€˜/tmp/pip-install-tj_Uqm/MySQL-python/setup.pyβ€™β€œ'β€β€˜;f=getattr(tokenize, β€˜"β€™β€œβ€˜openβ€™β€β€™β€œβ€˜, open)(file);code=f.read().replace(β€™β€β€˜"’\r\nβ€™β€œ'β€β€˜, β€˜"’"’\nβ€™β€œ'β€β€˜);f.close();exec(compile(code, file, β€˜"β€™β€œβ€˜execβ€™β€β€™β€œβ€˜))’ install --record /tmp/pip-record-ipvpL6/install-record.txt --single-version-externally-managed --compile --install-headers /home/circleci/Humanyze/wyze/src/venv/include/site/python2.7/MySQL-python” failed with error code 1 in /tmp/pip-install-tj_Uqm/MySQL-python/
Exited with code 1

As best as I can tell, there is nothing different in the python releases that would cause this. I am unsure what the other differences are between containers or what a solution is. Any help is appreciated. Thanks in advance!

I’m seeing the same issue.

So, I noticed that they switched the python:2.7.16 image to using Debian Buster. If you use the python:2.7.16-stretch image, it’ll work (I believe this was the image used before the distro version switch).