vollib/py_vollib

Importing py_vollib causes a MySQL import error in a Flask App

tmb-ltsdw opened this issue · 1 comments

Hi everyone, I am trying to use this library to calculate IV and Greeks for an array of option prices and when I was developing on my local windows machine everything went smoothly but on trying to run the code on a Flask application that uses a MySQL connector to read price data, simply importing the py_vollib library causes the application to break with the following error:-

  File "*/.venv2/lib/python3.6/site-packages/MySQLdb/__init__.py", line 18, in <module>
    from . import _mysql
ImportError: /lib64/libstdc++.so.6: cannot allocate memory in static TLS block

Joined by another exception here :-

  File "*/.venv2/lib/python3.6/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 167, in dbapi
    return __import__("MySQLdb")
  File "*/.venv2/lib/python3.6/site-packages/MySQLdb/__init__.py", line 24, in <module>
    version_info, _mysql.version_info, _mysql.__file__
NameError: name '_mysql' is not defined

SQLALchemy works fine on my Windows machine but not on this RedHat Linux instance that I am developing on. I would appreciate if you could provide any insight on the C level imports that occur when using this library that is probably causing this issue / conflict. As for me I'm a bit boggled on how to go about debugging it.

There are no SQL dependencies in py_vollib, so the root cause must lie elsewhere.