There are some occasions where you want to reinstall OctoPrint - like if OctoPrint doesn't start anymore after a failed update or if you can't update OctoPrint to a newer version because something went wrong during the update.
Sometimes it also helps in situations where the filesystem was damaged (for example after a pulled plug, a power outage, a crash and similar events).
In those cases I would highly recommend to start OctoPrint just once, then backup everything you need via the backup assistant in the settings menu and to flash a fresh image and restore your backup.
You never know what besides of OctoPrint was damaged and the system might become unstable.
To reinstall OctoPrint you open an ssh connection and copy/type the following into the command line:
~/oprint/bin/pip install --force-reinstall OctoPrint==X.X.X --no-cache-dir
You have to replace the X.X.X with the version of OctoPrint you want to install - at the time of writing this guide the latest version was 1.6.1, but in the future the version will change.
So for 1.6.1 it would be
~/oprint/bin/pip install --force-reinstall OctoPrint==1.6.1 --no-cache-dir
followed by pressing enter.
Now the selected version of OctoPrint should reinstall.
When the installation has finished without an error you can start OctoPrint either with
sudo service octoprint restart
or by simply restarting the pi with