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/base_command.py", line 176, in main
2019-11-06 06:10:58,809 ! status = self.run(options, args)
2019-11-06 06:10:58,809 ! File "/home/pi/oprint/local/lib/python2.7/site-packages/pip/_internal/commands/install.py", 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/wheel.py", 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.

3 Likes