OctoPrint PolarCloud Bugfix
This morning I was setting up a new OctoPi for my Creality CR10 so I can monitor the larger printer and take long timelapses. One of the plugins I am a fan of for OctoPrint is the PolarCloud Integration. This hooks the OctoPrint server up to PolarCloud. While a bit simple, Polar cloud allows me to manage my printer outside of my network without opening up the ports on my router. It also allows me to connect multiple prints up to a single account, so I can manage both printers at once.
The problem comes with when you go into the OctoPrint Plugin Manager, and you go to install the PolarCloud Plugin, the install throws a cryptography setup command: Invalid environment marker: python_version < '3'
error upon install. When I first ran into this, it took a few hours of digging through dependency chains to find out why cryptography wasn’t installing properly. So when I ran into it a second time, I figured that it hadn’t been fixed yet so I would write a quick reference piece in case me or anybody else runs into this problem.
It turns out the OctoPi image ships with an ancient version of setuptools. For those who are not python developers, SetupTools is a python package that pip
(Python Install Package: the python package manager) uses to install packages once they have been downloaded. Recently in the migration from python2 to python3, SetupTools added a python_version
property. The ancient version that OctoPi ships with does not have this attribute, so when installing the cryptography
package, it comes back undefined and that errors.
The solution is to upgrade setuptools
on the OctoPi, however for those who are not software engineers, this can be a tricky.
Step 1: SSH into your OctoPi
Step one of fixing this is ssh into your octopi. Im on a mac so I have ssh already in my shell, but Windows users can use PuTTY.
1 | ssh pi@octopi.local |
Put in your password. If you never changed it, OctoPi’s default password is
raspberry
.
Step 2: Enter the Virtual Environment
Python has this concept of Virtual Environments, allows for multiple versions of python and packages to exist side by side on the same operating system. You create a virtual environment or virtualenv and install packages into it. When you want to use those versions of those packages, you activate that particular virtualenv.
OctoPrint works in an virtualenv named oprint
. To Activate it:
1 | source ~/oprint/bin/activate |
Step 3: Update SetupTools
Now that we are inside of the virtualenv, to update:
1 | pip install setuptools --upgrade |
Once this command is done running, you can exit your ssh session and install Polar Cloud from the Plugin Manager.