Python Error: Unsupported Pickle Protocol 5

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!

Troubleshooting Task Scheduler Running a Python Script

program: Python
package manager: PIP
ide: Spyder

The Background

Creating an automated or scheduled task on your computer in Windows or Mac is pretty awesome for saving time doing routine tasks, particularly routine scripts or program runs. However, when setting up the task in the Task Scheduler (Windows), there isn’t much of a GUI that shows what is happening with the program like there would be in an IDE.

I was setting up a Python script to automate. To complicate things, I use Spyder IDE to code in.

The Problem

I created a *.bat file. Double clicked on the file to run the script, and a window popped up and quickly closed.

I doubled checked in Spyder to see if the program ran, sure enough, ran like a charm.

The Solutions

Yes, plural solutions. There were lots of things wrong.


The biggest problem was that Spyder seems to have it’s own package folder that has some built in packages like Numpy, Matplotlib, and Pandas. I’m sure there are others. So, when I run my program in Spyder, everything ran great. But when I ran it using my *.bat file, it was running without the IDE and therefore didn’t have the built in scripts.

To figure this out, I opened the *.py file (my program) using IDLE, then ran (F5). The shell told me:

import numpy
ModuleNotFoundError: No module named ‘numpy’


pip install numpy

That’s the short answer.

The long answer is to systematically install each package that had been assumed to be installed in Python.

This is done by continuing to run the Python script to see why it crashes. This will happen with similar ‘ModuleNotFoundError’s as seen above. Each module not found, pip install that package.

pip install <package name>

The above command is typed directly into Command Prompt, if pip has been installed correctly.

One the program runs completely within IDLE, it should now run smoothly in the Task Scheduler.


Setting up a Task Scheduler might be a bit confusing. It’s an app or program on Windows now of the same name. It’s also found in the directory:

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools

When you click create task you will be stepped through a few tabs to create the new task.

Name the task, select whether you need to be logged in for it to run or not, set your triggers which can be time of day or specific days, and action is the tab that holds the information for what program to run.

Create a *.bat File

Head to this other post I’ve made on How To Create a *.bat File in Windows For Task Scheduler To Run Python Script. It should give you all the details.

Creating a *.bat file to run your script is probably the easiest way to create your action in the Task Scheduler. Once your *.bat file is created, I would suggest going to the actual *.bat file and double clicking on it to confirm that it does work.

tip: insert some print code or a sleep() statement at the end of your code so that you can get a confirmation that it has actually run. Sometimes the programs run pretty quick and you don’t get any feedback that it’s run.

If your *.bat file runs properly, in the Action tab of the Task, add a new action, and browse to the *.bat file you created above and select ‘start a program’ as the action you’d like to accomplish.

This should now show up as a task in your task scheduler. To see if it’s going to work before you wait for your triggers to be hit, right click on the task and select run.

Hope this helps you troubleshoot your scheduled task in Windows.

How To Create a *.bat File in Windows For Task Scheduler To Run Python Script

If you would like to run your Python script without having to open your IDE to complete a task, you can do so by creating a *.bat file. I’d be interested to hear what other reasons why you found this page to create your *.bat file in the comments below, because I’m sure there are some pretty cool tasks out there you are doing.

The format of the *.bat file is as:

“<location to python.exe file>” “<location of your script you want to run>”

For me, this looked like:

“C:\Python\Python39\python.exe” “C:\Python\Python39\programs\”

Saving the File

Saving the file is the tricky part.

Make sure you have the drop down save as type selected to *.*. If you don’t your file will save as filename.bat.txt.

To avoid any file location issues, I’d suggest saving this *.bat file in the same location you have your python script in.

Changing Memberpress Recurring Product Description at Checkout

Software: WordPress
Plugin: Memberpress
Plugin: My Custom Functions


Memberpress is a plugin for WordPress that allows the owner of the website to create a powerful member based website. It allows you to lock out certain pages unless the user has signed up for a specific membership, all based on rules you set in the backend.

When a user purchases a membership on the website, they are directed to a payment portal that has the description of what they’re about to buy and asks them to input a payment method. It looks something similar to this.

Memberpress Checkout Description Change

Changing Memberpress Checkout Item Description

Circled above is Initial Payment. It’s a setting that cannot be changed in the Memberpress dashboard in the backend. Why not?! Who knows!

I suspect that this description has something to do with selecting the recurring payment when creating the membership.

To change what it says here, a little Javascript is required. If you do not have a plugin installed, I would suggest using a plugin to insert the javascript. If you do not use a plugin, and instead edit the functions.php file, with one theme update, you will lose your customization and have to do it again (smart WordPress practice is to avoid this sort of issue). At the time of writing this article, My Custom Functions seemed like the smartest plugin to use to edit the php/javascript.

Once the plugin My Custom Functions has been installed, it is located under settings -> PHP Inserter.

Add the following code:

function change_checkout_description($args, $txn) {
	$membership = new MeprProduct($txn->product_id);
	$args['items'][0]['description'] = $membership->post_title . ' - Initial Payment';
	return $args;
add_filter('mepr-invoice', 'change_checkout_description', 10, 2);

In the above code, change ‘ – Initial Payment ‘ to what you would like it to be.

Save the custom code, and you should see changes reflected on the front end of your website.

Hope this helps!

Creating a Link in MINDBODY’s Branded Web

website: MINDBODY Branded Heal Code Manager
website software: WordPress
WordPress plugin: MINDBODY Widget

What Is | MINDBODY Branded Web

MINDBODY offers what they refer to as Branded Web Experience that comes in the form of Healcode. A bit confusing, but in a nutshell, they offer an app that integrates with your website to give a user the opportunity to register for classes or buy packages – all the customer front end options one is used to in MINDBODY, through your own company’s website.

The benefit of using such a tool is that the customer doesn’t get redirected away from your website in order to perform this operation. It happens all through dynamic API calls.

You must first enable Branded Web for MINDBODY, which goes to some office somewhere that then do something magical with it and then enable it for you. Once this is done, you’ll get a user/pass notification that you can now use it. I think if I remember correctly, I had a bit of trouble here because they didn’t really respond right away so I had to send them another reminder message.

Creating a Link | MINDBODY Branded Web

Links create shortcuts from your company website to your MINDBODY software. Using these links via. your website, customers can create and manage their accounts as well as buy whatever it is you sell. When the link is clicked on, it will automatically pop up a shopping cart type screen where the customer can do what they clicked on the link to do.

To create a link, browse to the Branded MINDBODY website, log in, and within the top menu, there is an option called links.

Create a link within MINDBODY Branded Web

From the drop down menu, there are a few options to choose from, one of which is Buy Now – Pricing Options which will allow further choices of what exact product you would like the link to point towards. For many people, MINDBODY is a way to manage a Studio type business, so this is likely different classes or workshops that you’re offering.

Using the Link in a Website | MINDBODY Branded Web

Once the desired selections are made, scroll down to find the exact code for the link. It will look something like this:

Example of Copy Link code section for MINDBODY Branded Web

So I have the code, now what?

Once you have that code, it needs to be added to the location you wish to put it on your website. I’m going to go through the process of adding it into a WordPress website, but if you don’t have a WordPress website, that code above can be copied and pasted in place where you’d like it on your website. Note that your website will need to have Javascript support to work the widget.

Deploying a MINDBODY Link in WordPress

MINDBODY Widget within WordPress Instructions

MINDBODY has a plugin for WordPress called MINDBODY Widget. Install this, and deployment is very straight forward. You simply copy the code for the link created on the Branded Web MINDBODY site, add new Widget within the plugin on WordPress, then paste the code into Widget Code section shown below.

MINDBODY Widget Shortcode Creation within WordPress

If you copy and paste the exact, full code you copied from the MINDBODY Branded Web site into the Widget Code field, give the Widget an appropriate name, and click create, you should then have a new screen that shows you all of your created links and their related shortcode.

MINDBODY Widgets Shortcode List

What you need to do now is copy that Widget Shortcode, above it would be:

 [hc-hmw snippet="Teachers"] 

and paste that into your WordPress website where you want it. Save your page, open the frontend of that page and make sure it looks how you like it.

Hope this helps!