0

I am having an issue when trying to import a .spydata file in Spyder. I created a .spydata file in a console using Spyder, then I opened a new console (same environment and everything) and tried to import the file. Then Spyder throws an error:

'Unable to load .../.spydata' The error message was: 'Object arrays cannot be loaded when allow_pickle=False'

The .spydata file contains these object types: List, Set, Array, Dictionary, int, tuple, DataFrame, timedelta, timestamp.

I was able to succesfully save and import a .spydata file with less objects (only two cells from the original script run).

I tried opening the file in a new environment with Numpy==1.16.1 (and pandas==1.1 for compatibility issues) as suggested in this question. But then I got this error message:

'Unable to load .../.spydata' The error message was: "Can't get attribute '_unpickle_block' on"

In this question the solution to that last error given by @CarlosCordoba is:

(Spyder maintainer here) This probably happened because you used two different versions of Pandas to save/load your data.

Yes, that was the problem. I had to downgrade pandas to version 1.1. And users seem to be able to fix the problem saving and loading the data with the same pandas version. Not me, I get the first error message.

Environment package versions:
Python   3.10.6
Anaconda 2.3.1
Spyder   5.3.2
Ipython  7.33.0
Numpy    1.23.3
Pandas   1.5.0
  • Are you using the default interpreter or a custom one? Could you provide an example code snippet to test locally? – Daniel Althviz Oct 18 '22 at 16:24
  • @Daniel Althviz I'm using the default interpreter, meaning the Python interpreter is the same as Spyder's. I can't provide a example code snippet because the data is confidential. I just run the code, save the data in a .spydata file using the Variable Explorer and the try to open it back again in a new console. I edited the question to provide examples of the type of objects in the .spydata file. – Martin Clausse Oct 19 '22 at 17:17

1 Answers1

2

Found it! The problem was a single numpy.ndarray In my case, I just converted the numpy.ndarray into a list. None of the other types of objects threw an error. The .spydata file had basic Python structures, Pandas objects and even PuLP objects. It is still an open issue for Spyder.