2

I am starting to use spyder, and I am having an issue in importing the data. Yesterday, I saved all variables using 'save data' in variable explorer, generating a file called data.spydata. I opened a new project just to test if it was OK, and I was able to open it. Today, I am attempting to importing all data from that data.spydata. Initially it complained about no pandas, and I have installed it using pip install pandas, and stopped complaining about. Now, the message is

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

The sentence appears to end without a complement, and I have no idea what it means... the variables were diverse, but mainly panda's data frame, lists and dictionaries... a request response, and json from this response...

The spyder is running in a conda environment. After the first message, I verified all packages used in the original code (pandas, request) are installed in that environment...

I appreciate any help.

hamagust
  • 728
  • 2
  • 10
  • 28
  • 1
    (*Spyder maintainer here*) This probably happened because you used two different versions of Pandas to save/load your data. – Carlos Cordoba Feb 03 '22 at 15:46
  • @CarlosCordoba Thank you very much for taking your time to send me the message! updating the Pandas version solved the issue! – hamagust Feb 03 '22 at 16:07

1 Answers1

6

I recently encountered the same problem! Then I realized that the pandas that I generated the pkl has version 1.4.0; while the pandas that I used to extract pkl has version 1.3.0.

So what I do is to downgrade/upgrade pandas. This is a similar problem

Sijing Tu
  • 76
  • 3
  • Thank you! Updating pandas solved the issue! Not sure what version I had before, but the version was 1.3.5. I updated t o1.4.0, and it solved! Just a comment/doubt... considering the mentioned here [https://stackoverflow.com/a/58822947/8939181], maybe we have no problem if we have the newest version to extract (no downgrade is needed)? – hamagust Feb 03 '22 at 16:15
  • Same problem with matplotlib. Error message reads *Spyder is unable to open the file you're trying to load because matplotlib.axes.subplots is not installed.* Downgraded matplotlib from 3.7 to 3.6. Then Spyder loaded the file but threw a warning message in the console *This figure was saved with matplotlib version 3.6.2 and is unlikely to function correctly.* So then I knew which version the file was saved in. There is definitively an advantage in using conda environments... – Simone Jul 11 '23 at 10:27