Skip to content

[Solved] ‘Object arrays cannot be loaded when allow_pickle=False’

Last Updated on 2021-02-20 by Clay

python
Display Python code on the screen

Introduction

I often got this error message when I learning about machine learning by Python, recently.

'Object arrays cannot be loaded when allow_pickle=False'

The reason for this message is actually very clearly. In fact, it’s just that “allow_pickle” is adjusted to False after Numpy package is upgraded.

And it caused us to be hindered when reading some pickle-encapsulated training data.


Solution

So far, I haven’t seen any particularly good solutions, which are faster and easier to take effect, probably nothing more than downgrading Numpy package.

For detailed discussion and how to temporarily change the program, please refer to this article: https://stackoverflow.com/questions/55890813/how-to-fix-object-arrays-cannot-be-loaded-when-allow-pickle-false-for-imdb-loa/56243777

If you are willing to downgrade the version (in fact, it is usually no obvious disadvantage), just use the following command:

pip3 install numpy==1.16.2

At least my own test is effective, and I hope it is also effective for everyone.

Leave a Reply