IBM / db2-samples

Db2 application code, configuration samples, and other examples
https://www.ibm.com/analytics/developing-with-db2
Apache License 2.0
85 stars 86 forks source link

Add Warning about Python Versions for Models Stored in Tables #56

Open db2Dean opened 1 year ago

db2Dean commented 1 year ago

This issue is for the In DB Model Deployment and Management directory. I suggest that a note be added to the README discussing python version issues. I ran the steps in the readme and the UDF would fail with a "<class 'KeyError'>: 110" error. I created the ML model joblib and b64 string on my Mac that is running Python 3.7 and inserted the model into a table in my database. Then the UDF would fail with the indicated error. The database server is Linux running Python 3.9. I solved the problem by training the model and converting it to base64 on the database server. It should be noted that previous to this, I was getting the same error when my database was running Python 3.6. I upgraded the python version on the database server in an attempt to solve the problem.

kdrodger commented 1 year ago

@pwharned is this interesting to you? Are you able to take a look at what Dean's reported? Thanks.

pwharned commented 1 year ago

Sure thing, I will add a note and an error catch example if possible-it would be interesting if there were a way to manage multiple python installations at the database server as this would improve extendability but i believe db2 needs to be restarted when the PYTHON_PATH variable is changed. I’ll double check. You could potentially hack it with symlinks but i doubt thats advisable…

Unfortunately lots of minor versions of python introduce breaking changes especially for scientific computing languages.