Skip to content

Python Error: Unsupported Pickle Protocol 5

  • by

python ide: Spyder
os: Windows
package: Pickle5
package: Pickle


In a previous article on trying to discover why a program would run in Spyder, and then when I ran it in IDLE or from command prompt it would fail saying that the packages weren’t installed. The skinny of how to resolve this issue was from command prompt type:

pip install <package name>

The explanation of this is that when one installs Spyder, it has built in Python Interpreter, which can be discovered within Sypder -> Tools -> Preferences.

Within the console of Spyder, one can also run the command:

import sys

and then from command prompt (or IDLE) you can run the same command (if you’re using command prompt, you’ll have to first enter into Python using the python command, which should be recognized because you have linked this command to a PATH or PYTHONPATH in your environment variables). If the two system paths match up (the location of python.exe), the exact same python packages will be used by both IDLE and Spyder.

However, if the system paths don’t match up it is likely that the two IDEs are running different Python environments.

The Problem

After I installed the necessary packages that Spyder had come installed with that I didn’t have installed with Python I had separately installed, my program was able to run.

However, my program modified files, and because the two versions of Numpy that were being used were different, the following error showed up:

Python Error: Unsupported Pickle Protocol 5

The Solution

The simple solution may have been to install the package pickle5:

pip install pickle5


This package backports all features and APIs added in the pickle module in Python 3.8.3, including the PEP 574 additions. It should work with Python 3.5, 3.6 and 3.7.

and then used that in my program running in Spyder where the Pickle error was being experienced:

import pickle5 as pickle

However, when trying to install pickle5 I experienced the issue:

error: Microsoft Visual C++ 14.0 is required. Get it with “Build Tools for Visual Studios”:

I went about downloading this package, but it appeared it was going to download the whole Visual Studio which was about 1.5Gb and as a general rule I try not to clutter up my computer with this kind of massive downloads (like Visual Studio is). Although, likely as a programmer you’ll have to have this in some shape installed on your computer.

So, why not just change the Python Interpreter to the one I first installed on my computer, outside of Spyder, the same one IDLE runs. For me, this was the location: C:\python\python39\python.exe (as shown in the image above, and discovered with the command prompt sys.executable report we did above).

If you do this, and restart Spyder, you’ll likely get an error saying that the console was unable to load, and to install the Spyder kernels. This command solves that:

pip install spyder-kernels

One thing I learned from all of this was that Spyder recommends the programmer to install and setup Spyder using Anaconda (though they do have a curious Important note at the top of that page explaining installing Spyder without Anaconda might be beneficial to avoid package dependency conflicts, as we have just experienced issues with being independent ironically!). I’m not sure if all of this would have been eliminated as a result of installing Spyder using Anaconda, because when I created a scheduled task I was then running the program outside of Spyder. However, I’m sure that there is a way to install Spyder such that it uses the existing Python interpreter installed on the system, which would be using the same Python interpreter from the beginning, and it hopefully would have installed the required site-packages in the same folder.

Hope this helps!

Leave a Reply

Your email address will not be published. Required fields are marked *

16 − fifteen =