Search code examples
pandasscikit-learnversioncloud-foundrypredix

CloudFoundry force pandas version


I developed a program locally that works just fine, however when I push it to CloudFoundry/Predix, some version discrepancies make it incompatible. I'm developing locally and use a Jupyter notebook. I use some pickled files. When I check

import pandas as pd
pd.__version__

I get

'0.20.1'

HOWEVER once the app is in the cloud, it crashes. Checking the logs it gives messages like

2018-06-13T10:35:18.88+0200 [APP/PROC/WEB/0] ERR /home/vcap/app/.cloudfoundry/0/python/lib/python3.4/site-packages/sklearn/base.py:311: UserWarning: Trying to unpickle estimator ExtraTreeRegressor from version 0.18.1 when using version 0.19.1. This might lead to breaking code or invalid results. Use at your own risk.

So it seems like on the server, Pandas v 0.19.1 is installed. I don't understand how it thinks the pickled files were pickled with Pandas 0.18.1, as it seems to me I'm using 0.20.1. So I'm trying to force Pandas to be version .18 or .20 by putting the line pandas==0.18.1 (or pandas==0.20.1 respectively) in my requirements.txt. When doing a cf push I do see lines like 2018-06-13T10:18:26.81+0200 [STG/0] OUT Collecting pandas==0.18.1 (from -r /tmp/app/.cloudfoundry/0/requirements.txt (line 3)), so it would SEEM that I'm installing version 0.18.1 to avoid compatibility issues, however the error still persists and it seems like I'm running .19 on the server. What am I missing here? How can I make sure version .18 is being used?


Solution

  • The error:

    /home/vcap/app/.cloudfoundry/0/python/lib/python3.4/site-packages/sklearn/base.py:311: UserWarning: Trying to unpickle estimator ExtraTreeRegressor from version 0.18.1 when using version 0.19.1. This might lead to breaking code or invalid results. Use at your own risk.

    is moaning about scikit-learn and not pandas, it's stating that your pickled model is from an earlier version so either retrain with the version that is installed or force the version to the one that your pickled model was trained with