'ValueError: unsupported pickle protocol: 5 in google Colab

I'm trying to read pickle file in google Colab. Then it's getting this problem. I tried to updated the python version to 3.9.12 and it didn't work. I really appreciate the explication step by step google Colab code



Solution 1:[1]

You can pip install pickle5 and read your file this way:

!pip3 install pickle5
import pickle5 as pickle
with open('your_file_name.pkl', "rb") as fh:
  data = pickle.load(fh)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Iman Feghhi