Search code examples
pythongoogle-colaboratorypickle

Use specific version of package in Google Colab


I have some files with models serialized with pickle, but now when i try to unserialize them, i get:

UserWarning: Trying to unpickle estimator LogisticRegression from version 1.0.1 when using version 1.0.2. This might lead to breaking code or invalid results. Use at your own risk. For more info please refer to: https://scikit-learn.org/stable/modules/model_persistence.html#security-maintainability-limitations

How can i specify colab to use that version of pickle


Solution

  • Pickle is part of The Python Standard Library, so you cannot change its version without changing your Python version. However, that warning message refers to the version of Scikit-learn, not pickle. You can install Scikit-learn 1.0.1 as follows:

    !pip install scikit-learn==1.0.1