This error occurs because the pickle file you're trying to load (output3_001_dict.pickle) was created with a different version of NumPy than the one you currently have installed. The error specifically indicates that your current NumPy installation doesn't have a module named numpy._core, which was likely present in the version used to create the pickle file.
Here are several solutions to fix this:
1. Upgrade NumPy to the latest version
pip install --upgrade numpy
2. If upgrading doesn't work, try installing a specific version
You might need to match the exact version used to create the pickle file. If you know which version was used, install it with:
pip install numpy==x.y.z
(Replace x.y.z with the specific version number)
3. Alternative approach: Use pickle5 for compatibility
If you're using Python 3.8+, you can try:
import pickle5 as pickle
with open('output3_001_dict.pickle', 'rb') as file:
data = pickle.load(file)
4. If you know the data structure, reconstruct it manually
If the pickle file contains simple data structures, you could write code to reconstruct it from the raw data.
5. Try loading with dill instead of pickle
pip install dill
Then:
import dill
with open('output3_001_dict.pickle', 'rb') as file:
data = dill.load(file)
6. Check the pickle file contents without loading
You can inspect the pickle file to see what it's trying to load:
import pickletools
with open('output3_001_dict.pickle', 'rb') as f:
pickletools.dis(f)
The most likely solution is #1 (upgrading NumPy). If that doesn't work, try the other solutions in order. The issue stems from version incompatibility between the NumPy used to create the pickle file and your current NumPy installation.