OpenSSL issue with mysqlclient

Hi,

I wanted to note a bug I’ve encountered. I’m using a cluster running CentOS 7. I installed my own forked version of cellprofiler 3.1.8 (here).

I used this conda environment file:

(#) run: conda env create -f environment_edv1_4.yml
(#) run: conda env update -f environment_edv1_4.yml
(#) run: conda env remove -n cellprofiler_edv1_4
name: cellprofiler_edv1_4
(#) in order of priority: highest (top) to lowest (bottom)
channels:
- anaconda
- goodman # mysql-python for mac
- bioconda
- cyclus # java-jdk for windows
- conda-forge # libxml2 for windows
- daf #wxpython for linux
dependencies:
- appdirs
- boto3
- cython
- h5py==2.8
- ipywidgets
- java-jdk
- jupyter
- libtiff
- libxml2
- libxslt
- lxml
- packaging
- pillow
- pip
- python=2
- pyzmq=15.3.0
- mahotas
- matplotlib!=2.1.0,>2.0.0
- mysqlclient=1.4.2
- numpy
- raven
- requests
- scikit-image>=0.13
- scikit-learn
- scipy
- sphinx
- tifffile
- wxpython=3.0.2.0
pip:
- cellh5
- centrosome
- inflect
- prokaryote==2.4.1
- javabridge==1.0.18
- python-bioformats==1.5.2 #changed from 1.4.0 17-10-18
- git+https://github.com/edlaw89/CellProfiler@ed_edit

An error occurs on startup to do with connecting to the MySQL server. The server is set up correctly as I can run the same compilation off a separate linux machine.

This is the error:

File “/mnt/nfs/home/nel56/.conda/envs/cellprofiler_edv1_4/lib/python2.7/site-packages/cellprofiler/modules/exporttodatabase.py”, line 1947, in prepare_run
self.db_name.value)
File “/mnt/nfs/home/nel56/.conda/envs/cellprofiler_edv1_4/lib/python2.7/site-packages/cellprofiler/modules/exporttodatabase.py”, line 308, in connect_mysql
connection = MySQLdb.connect(host=host, user=user, passwd=pw, db=db)
File “/mnt/nfs/home/nel56/.conda/envs/cellprofiler_edv1_4/lib/python2.7/site-packages/MySQLdb/init.py”, line 84, in Connect
return Connection(*args, **kwargs)
File “/mnt/nfs/home/nel56/.conda/envs/cellprofiler_edv1_4/lib/python2.7/site-packages/MySQLdb/connections.py”, line 166, in init
super(Connection, self).init(*args, **kwargs2)
OperationalError: (2026, ‘SSL connection error: SSL_CTX_set_tmp_dh failed’)

After doing some googling I came across this, which details an issue between MySQLdb/mysqlconnector and OpenSSL.

Running

conda list --show-channel-urls

revealed I was using openssl v1.1.1. Incorporating “openssl=1.0.2p” into the dependencies list solved the issue, but it’s not a good solve. Note from the discussion linked above, that adding the “use_pure=True” code at the end of the connection statement is a potential solve for this issue, however that is for mysqlconnector, whilst the cellprofiler exporttodatabase module uses MySQLDB to initiate the connection. I tried adding the “use_pure=True” code at this point but to no avail.

If anyone could take a look at this, to see if they can replicate the error, in order to find a better fix, I’d be much obliged!

Cheers,
Ed