Trying to update OctoPrint on OctoPi 0.16 gives me an "AssertionError" about "assert have_directory_for_build", how do I solve this?

There have been some reports that upon trying to update OctoPrint on an OctoPi 0.16 image the update can fail with an AssertionError and assert have_directory_for_build:

2019-11-06 06:10:58,806 ! Exception:
2019-11-06 06:10:58,807 ! Traceback (most recent call last):
2019-11-06 06:10:58,808 ! File "/home/pi/oprint/local/lib/python2.7/site-packages/pip/_internal/cli/", line 176, in main
2019-11-06 06:10:58,809 ! status =, args)
2019-11-06 06:10:58,809 ! File "/home/pi/oprint/local/lib/python2.7/site-packages/pip/_internal/commands/", line 346, in run
2019-11-06 06:10:58,810 ! session=session, autobuilding=True
2019-11-06 06:10:58,810 ! File "/home/pi/oprint/local/lib/python2.7/site-packages/pip/_internal/", line 886, in build
2019-11-06 06:10:58,811 ! assert have_directory_for_build
2019-11-06 06:10:58,811 ! AssertionError
2019-11-06 06:11:00,314 ! You are using pip version 19.0.1, however version 19.3.1 is available.
2019-11-06 06:11:00,314 ! You should consider upgrading via the 'pip install --upgrade pip' command.

The underlying cause for this error appears to be a bug in the version of the pip tool that is included on the image and that can fail under certain conditions (the precise nature of these conditions in the context of this update problem has not yet been determined). See

The solution is simple. SSH into your Pi (default user/password is pi and raspberry) and run the following commands:

source ~/oprint/bin/activate
pip install -U pip

That will update the version of pip to one that doesn't have this bug. After that the update should run through.

:warning: If you have run into this error, you still have not upgraded to Python 3

This error only occurs on legacy Python 2 installs. You can find out how to upgrade here.


So, I forget about the PI messing with,and setting up.. How do I tell what version of PI 3b+ I am running, and not sure about what you mean about "SSH into your PI, and what's the chance that trying this will not mess up maybe getting to where I can't use the Octoprint?

The OctoPi version will be listed in the bottom left hand corner of the UI:


There's loads of guides on the internet, you can choose one. This is one that I found linked to on the forums, but there's thousands if you search 'ssh raspberry pi'.

Very low - unless you start deleting other things, it should not make a difference to OctoPrint's install.

GREAT, that worked and now updated, but now it is showing an alert that Python 2 is old and wants me to update to Python 3. Can this be done on computer without messing with hooking up cable and pulling out the micro sd out of PI? Directions say something about using the backup and restore function of Octoprint, then download new Python and then restore from Octoprint. Not really sure what exact procedure is . Sorry for not being that versed on this. Seems like when I don't repeadely do things anymore, I forget or don't understand. Part of getting old I guess.

except, that update script requires you to be on octopi 0.17 if I'm not mistaken, which has the required python 3 included with the image. Otherwise you have to manually install python 3 on your octopi 0.16 image, which I don't know how well works.

So I am probably better, just ignoring the alert for now and just keep using 2?

No, you should upgrade as soon as possible, as it says using the instructions set out in the link from the notification itself.

yea my Octopi version is 0.16.0 and just upgraded Octoprint to 1.7.2.
So I have to go through all that stuff about downloading onto computer, the using an imager and all that? Oh boy, I forget all that stuff. I have Octopi and Octoprint running on wifi, so not sure what's going on. Instructions say backup Octoprint with "backup/restore plugin, and download. Download newer version of Octopi & setup, then restore Octoprint. Maybe someone can make that a little clearer, and thanks.
So let me see if I get this. I create a backup in Octoprint, download it to computer, then go get latest version of Octopi, 0.18.0, and download that to computer, (which is a zip file) and then unzip that file (which is just an image file) then what? When I double click on that image file , it says it is corrupt, so there are no setup files.

The OctoPrint website has full step-by-step instructions, and is linked where it says 'download and setup' OctoPi.

It doesn't need to be clearer - you've just rewritten all the steps accurately, which shows you have understood the process exactly.

I have made a backup and downloaded it to computer, and have went to the Octoprint site and downloaded the OctoPi 0.18.0 & Octoprint 1.7.2. link.. The file downloaded, I unzipped it, and once unzipped has one file "Octopi disc image" file. Double click on it, and comes up "file corrupted"
I hate to beat a dead horse, but what am I missing here?

This is what the guide that explains how to install OctoPrint looks like. If you aren't following that guide and are downloading the image manually you will have to open your imaging software and write it to the card like that. It doesn't say try and open the image file anywhere.

To avoid polluting this thread further (about an unrelated issue) please create a new topic in 'Get Help' to continue.