Thursday, January 12, 2023

Python failed to load a pickle: __randomstate_ctor() takes from 0 to 1 positional arguments but 2 were given

When I tried to load a Python pickle created at another host (host B), I encountered an error as follows:


__randomstate_ctor() takes from 0 to 1 positional arguments but 2 were given

It turns out that I had different versions of numpy at hosts A and B. To fix it, I went to host B where the pickle was created, figured out the version of numpy


$ pip list --format=freeze | grep numpy
numpy==1.24.1

At host A, I installed numpy


 pip install numpy==1.24.1

The problem went away!

No comments:

Post a Comment