Failed Update + Restart = Broken Octoprint (pkg_resources.DistributionNotFound: pytz>=0a)

What is the problem?
Octoprint failed to update via the web interface. No big deal, since it continued to run. Eventually, the Pi that it's running on was restarted, and ever since then, the Octoprint service fails to start using the following series of commands:

sudo service octoprint stop
source ~/oprint/bin/activate
setsid octoprint &

The entire error is as follows:

Traceback (most recent call last):
  File "/home/pi/oprint/bin/octoprint", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/home/pi/oprint/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/", line 2707, in <module>
  File "/home/pi/oprint/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/", line 686, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/home/pi/oprint/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/", line 584, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pytz>=0a

What did you already try to solve it?
sudo apt-get update and upgrade. Originally, the problem was: DistributionNotFound: tornado==4.0.2, but this was fixed this with pip install -Iv tornado==4.0.2.

Tried doing the same for pytz with pip install -Iv pytz==0a, but no such distribution of pytz exists. I already have pytz installed (2019.2), but it would seem >=0a doesn't recognize that.

Here's are logs (not sure if useful in this case though since this log probably contains stuff prior to the breakage):

plugin_softwareupdate_console.log and plugin_pluginmanager_console.log can be found here (new users only allowed to post 2 links):

Additional information about your setup
I can't run ~/oprint/bin/octoprint --version either. It produces the same error (DistributionNotFound: pytz>=0a). Running python 2.7.3.

I've attempted (and failed) updates to Octoprint in the past and have had to restart occasionally afterwards. This is the first time it seems like something has been corrupted. Or perhaps a partial update which ultimately failed may have changed some of the dependencies. Unclear exactly where the error stems from. It just seems like all of the version requirements had changed.

Just an idea
Try a pytz version with a letter in it like 2013b (pytz==2013b)
Here is a list of pytz versions

1 Like

SSH into your Pi. Then:

source ~/oprint/bin/activate
pip install --force-reinstall OctoPrint

Note that this will also update you to a current version - according to your log you are still on 1.3.7 and damn that's ancient:


Hah, no doubt it is. This printer is being used by a research group, not for personal use, so nobody has sole ownership over it and therefore nobody has been willing to risk breaking it by trying to update. I guess this is why.

At any rate, thanks for replying. Unfortunately, it still drew an error when I attempted your solution.


source ~/oprint/bin/activate
pip install --force-reinstall OctoPrint


DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at
ERROR: Exception:Traceback (most recent call last):
  File "/home/pi/oprint/local/lib/python2.7/site-packages/pip/_internal/cli/", line 186, in _main
    status =, args)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/pip/_internal/commands/", line 289, in run
    wheel_cache = WheelCache(options.cache_dir, options.format_control)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/pip/_internal/", line 291, in __init__
    self._ephem_cache = EphemWheelCache(format_control)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/pip/_internal/", line 267, in __init__
    self._temp_dir = TempDirectory(kind="ephem-wheel-cache")
  File "/home/pi/oprint/local/lib/python2.7/site-packages/pip/_internal/utils/", line 116, in __init__
    path = self._create(kind)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/pip/_internal/utils/", line 164, in _create
  File "/usr/lib/python2.7/", line 317, in mkdtemp
    dir = gettempdir()
  File "/usr/lib/python2.7/", line 261, in gettempdir
    tempdir = _get_default_tempdir()
  File "/usr/lib/python2.7/", line 208, in _get_default_tempdir
    ("No usable temporary directory found in %s" % dirlist))
IOError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/home/pi']

Further action:
I checked the permissions of /tmp and confirmed that it was set (correctly, i think) to:
drwxrwxrwt 5 root root 4096 Jan 28 19:48 tmp

The other possibility based on this post is that there is no room on the microSD card to perform the update operation. Checking disk space with df -h resulted in the following:

Filesystem      Size  Used Avail Use% Mounted on
rootfs          2.9G  2.8G     0 100% /
/dev/root       2.9G  2.8G     0 100% /
devtmpfs        428M     0  428M   0% /dev
tmpfs            87M  268K   87M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           173M     0  173M   0% /run/shm
/dev/mmcblk0p1   56M   20M   37M  35% /boot

But to be perfectly honest, I don't know what is what. So before I go around reformatting and deleting files, I attempted the first action suggested by PrintedWeezl:


Try a pytz version with a letter in it like 2013b (pytz==2013b)

pip install -Iv pytz==2013b

Same result as foosel's: [Errno 2] No usable temporary directory found...

So it seems like maybe the root of my problem is a number of file version incompatibilities, and I seem to be unable to fix those incompatibilities because I literally don't have enough disk space. Wow.

Currently I'm x-ferring all of the gcode and timelapses off of the Pi and onto my local computer to see if I can free up enough space to perform the upgrade. As it stands, though, there are still plugins and configurations that I don't want to mess up, so I'd prefer to not have to flash the entire thing and start over if I don't have to.

Any suggestions on where to go from here in case this doesn't work? Many thanks.

I'm pretty sure that just moving the files will work out, as things stand your file system is completely full.


pip install --force-reinstall OctoPrint


Downloading/unpacking OctoPrint
  Cannot fetch index base URL
  Could not find any downloads that satisfy the requirement OctoPrint
No distributions at all found for OctoPrint
Storing complete log in /home/pi/.pip/pip.log

Welp...not sure what's going on there, so I looked at the log:

/usr/bin/pip run on Wed Jan 29 01:27:31 2020
Downloading/unpacking OctoPrint
  Getting page  Could not fetch URL HTTP Error 403: SSL is required  Will skip URL when looking for download links for OctoPrint  Getting page
  Could not fetch URL HTTP Error 403: SSL is required
  Will skip URL when looking for download links for OctoPrint
  Cannot fetch index base URL

  URLs to search for versions for OctoPrint:
  *  Getting page
  Could not fetch URL HTTP Error 403: SSL is required  Will skip URL when looking for download links for OctoPrint  Could not find any downloads that satisfy the requirement OctoPrint

No distributions at all found for OctoPrint

Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/", line 104, in main
    status =, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/", line 245, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)  File "/usr/lib/python2.7/dist-packages/pip/", line 978, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/usr/lib/python2.7/dist-packages/pip/", line 157, in find_requirement
    raise DistributionNotFound('No distributions at all found for %s' % req)DistributionNotFound: No distributions at all found for OctoPrint

Before I went further down this rabbit hole, I tried downgrading pytz one last time, just in case...


source ~/oprint/bin/activate
pip install -Iv pytz==2013b

Oh snap it worked! Now to verify:

(oprint)pi@makergear ~ $ ~/oprint/bin/octoprint --version
octoprint, version 1.3.7

So, it'll do for now. But obviously you're probably going to want me to update :wink: I'd like to as well! Any chance you could advise on the update error I got now? Many thanks.

I love to flash. There's nothing like the exhilaration of knowing that my microSD is going to get exactly what it needs.

Music to play while you're reflashing your microSD.

1 Like

For the record, that's because your Python environment is so outdated that it still uses http to access pypi instead of https, which has been disabled by pypi for way over a year now.

Ouch. Is https supported in later versions of Python 2.7? Or will I have to upgrade it all to Python 3? I'm on a time crunch with my project and all of this work is setting me back, so it's a bit frustrating to have to sit down and do this maintenance, especially when I'm not confident that I could upgrade it and not break something.

You can fix this with a simple workaround actually. Take a look at this post:

tldr: Via SSH:

~/oprint/bin/pip install --index-url --upgrade pip
printf -- "[easy_install]\nindex-url =\n" > ~/.pydistutils.cfg