Precompiled mysql-python with VS2010 for Maya 2013?

Does anyone know if a precompiled version of the mysql-python database interface is available somewhere, compiled 64-bit with the Visual Studio 2010 compiler, suitable for use with Maya 2013’s Python 2.6? We have a setup that uses a 1.2.3 beta version (compiled for stock Python with VS 2008) that seems to work, but in theory being compiled against VS 2008 the runtime libraries could conflict, and I’ve not been lucky using any newer versions. I’d like to have a current (1.2.5) version compiled with VS 2010 for Maya.

Alternatively, I have the free Visual C++ Express 2010 installed, but I can’t seem to find a straight-forward list of steps to compile mysql-python with VS2010. There’s some notes about pointing the VS90COMNTOOLS enviroment variable, and a couple other things, but I haven’t had any luck combining them into a working compilation recipe.

FWIW, If perf is not super critical, pymysql is pure-python and thus needs no compilation. GitHub - PyMySQL/PyMySQL: MySQL client library for Python

Uses the same api as mysqldb so it should not involve any code changes

I gave PyMySql a quick look a year or more ago, when I was trying to track down what was ultimately an unrelated Maya crash problem. My memory is that there was some minor hiccup, but I was making direct API calls then. Now everything runs through SQLAlchemy, and I was planning on giving it another look.

I’d hoped the Maya community might be using and compiling mysql-python, but if there isn’t a precompiled binary available it would still be nice to be able to compile this up. I’ve pointed the VS90COMNTOOLS environment variable to the VS100COMNTOOLS path, and I get past the “VCVARSALL.BAT” not found error, but the build script doesn’t like the space in “ProgramFiles (x86)” and dies - I’m going to have to wait until I have some spare time and see if I can dig in and decipher what’s happening.

I think I have it built at home, i’ll try to post it tonight. I didn’t run any heavy tests though, just a simple import and connect

https://www.dropbox.com/s/2noiyjvzwaat12o/mysqldb.zip

Let me know if this doesnt run for you. I just tested with Maya 2014 and was able to connect locally and execute some queries.

EDIT: works with 2015 too :slight_smile:

Thanks, I’ll give it a try when I’m back at the Windows site. I’m OSX-only right now, but I eyeballed the “.pyd” and noticed it seems to be compiled against python27.dll, not python26.dll. Would this not cause problems when used with Maya2013, which still has Python 2.6?

oh, i didnt see that. i can run it against 26 tonight. Sorry about that

I’m working through the build process, and I’m going to try and get it build to these specs:

Python 2.6 64 bit / VS2010 (Autodesk/Maya2013)
Visual Studio 2010
MySQL 5.5 interfaces
MySQL Connector C 6.1

The build config in the mysql-python distribution seems to be hard-coded for Connector 6.0.2 (and perhaps MySQL 5.1). There some helpful info in this pull request I found, which makes some changes to handle 6.1, and the fact “config-win.h” apparently no longer exists in MySQL 5.5. But it still seems to assume a 32-bit setup (“Program Files (x86)” for the Connector directory).

I’d be curious as to any modifications you made to site.config/setup_windows.py to set up your build environment. I’ve managed to put SetupTools into the mayapy setup, and done a couple extra include paths so the Connector and MySQL headers get found. Currently it compiles and links (albeit with some warnings, but it is failing at the manifest stage. Time to pack it in until tomorrow… :slight_smile:

https://www.dropbox.com/s/2hd6fdgy71ht4h5/MySQLdb.win-amd64-2.6.zip

Give this a shot. I dont have 2013, but if i recall, they used py 2.6.4 which this is built against.

I did this a while back so i forget exactly what i did. To get this to fly on 2.6 i had to hack distutils, see Issue 4431: Distutils MSVC doesn't create manifest file - Python tracker. I think i just used a version of mysql that MySQLdb expected.

Thanks again - I’ll give this a try tomorrow back at the shop. Your compiling against a stock 2.6.4 instead of the Python installation inside Maya2013 explains one of the tweaks I had to make - Python26.lib is in Python26/libs in stock, but Maya moves it to Maya2013/libs. distutils does a compiler include path for the stock case, but I had to add one to setup_windows.py.

I’ve got it building, but the resulting “.pyd” is twice the normal size (3.6 MB vs 1.8MB). I’ll have to check if debug information is somehow being added, or duplicate libraries somehow being linked in.

[Later]: It may be the MySQL Connector C 6.1 that is adding the extra size. I tweaked my build to use the 64-bit version of this, instead of the 6.0.2 Connector. When I forked the 1.2 branch from the official github repo (which uses 6.0.2), my .pyd came back down to 1.8MB. 6.1 seems to bring in stuff from a “Secur32.dll” that 6.0.2 doesn’t, so perhaps it is doing extra stuff with passwords or link crypto.