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!

1 Like

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).

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.