Python, how to handle the error "ValueError: unsupported pickle protocol: 4"?

I am new to Python. I have to run this TargetFinder script ("User Analyzes") .

I installed all the necessary python packages and copied the code into a script I called main.py and ran it. I got this error:

 [davide@laptop]$ python main.py Traceback (most recent call last): File "main.py", line 8, in <module> training_df = pd.read_hdf('./paper/targetfinder/K562/output-epw/training.h5', 'training').set_index(['enhancer_name', 'promoter_name']) File "/usr/lib64/python2.7/site-packages/pandas/io/pytables.py", line 330, in read_hdf return store.select(key, auto_close=auto_close, **kwargs) File "/usr/lib64/python2.7/site-packages/pandas/io/pytables.py", line 680, in select return it.get_result() File "/usr/lib64/python2.7/site-packages/pandas/io/pytables.py", line 1364, in get_result results = self.func(self.start, self.stop, where) File "/usr/lib64/python2.7/site-packages/pandas/io/pytables.py", line 673, in func columns=columns, **kwargs) File "/usr/lib64/python2.7/site-packages/pandas/io/pytables.py", line 2786, in read values = self.read_array('block%d_values' % i) File "/usr/lib64/python2.7/site-packages/pandas/io/pytables.py", line 2327, in read_array data = node[:] File "/usr/lib64/python2.7/site-packages/tables/vlarray.py", line 677, in __getitem__ return self.read(start, stop, step) File "/usr/lib64/python2.7/site-packages/tables/vlarray.py", line 817, in read outlistarr = [atom.fromarray(arr) for arr in listarr] File "/usr/lib64/python2.7/site-packages/tables/atom.py", line 1211, in fromarray return cPickle.loads(array.tostring()) ValueError: unsupported pickle protocol: 4 

I do not know what this brine protocol means, and also my colleagues know nothing about it.

How can I solve this problem?

I am using Python 2.7.5 on the CentOS Linux 7.2.1511 operating system (Core)

+8
python pickle centos
source share
1 answer

Pickle protocol is basically a file format. From the documentation , The higher the protocol used, the later the Python version should have read the convex pickle .... Pickle protocol version 4 was added in Python 3.4, your version of python (2.7.5) does not support this.

Either upgrade to Python 3.4 or later (current 3.5) or create a pickle using the lower protocol (2) in the third parameter before pickle.dump() .

+10
source share

All Articles