Fatal Error When Starting Octoprint (bad marshal data)

What is the problem?

Can't start Octoprint

Throwing the following:

● octoprint.service - The snappy web interface for your 3D printer
   Loaded: loaded (/etc/systemd/system/octoprint.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Tue 2021-04-27 19:22:52 BST; 2s ago
  Process: 10844 ExecStart=/home/pi/oprint/bin/octoprint serve --host=${HOST} --port=${PORT} (code=exited, status=0/SUCCESS)
 Main PID: 10844 (code=exited, status=0/SUCCESS)

Apr 27 19:22:51 octopi octoprint[10844]: 2021-04-27 19:22:51,686 - octoprint.startup - INFO - ******************************************************************************
Apr 27 19:22:51 octopi octoprint[10844]: 2021-04-27 19:22:51,688 - octoprint.startup - INFO - Starting OctoPrint 1.5.3
Apr 27 19:22:51 octopi octoprint[10844]: 2021-04-27 19:22:51,689 - octoprint.startup - INFO - Starting in SAFE MODE. Third party plugins will be disabled!
Apr 27 19:22:51 octopi octoprint[10844]: 2021-04-27 19:22:51,689 - octoprint.startup - INFO - Reason for safe mode: setting in config.yaml
Apr 27 19:22:51 octopi octoprint[10844]: 2021-04-27 19:22:51,690 - octoprint.startup - INFO - ******************************************************************************
Apr 27 19:22:51 octopi octoprint[10844]: Could not initialize event manager: bad marshal data (invalid reference)
Apr 27 19:22:51 octopi octoprint[10844]: 2021-04-27 19:22:51,904 - octoprint.startup - CRITICAL - Could not initialize event manager: bad marshal data (invalid reference)
Apr 27 19:22:51 octopi octoprint[10844]: 2021-04-27 19:22:51,904 - octoprint.startup - CRITICAL - There was a fatal error starting up OctoPrint.
Apr 27 19:22:51 octopi octoprint[10844]: There was a fatal error starting up OctoPrint.
Apr 27 19:22:52 octopi systemd[1]: octoprint.service: Succeeded.

What did you already try to solve it?

Restarting

Have you tried running in safe mode?

Yes

Did running in safe mode solve the problem?

No

Additional information about your setup

OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible

Current Octoprint Version
Octopi 1.18.0

Try clearing pyc cache then starting the service again:

find /home/pi/oprint/ -type f -iname "*.pyc" -exec rm -fv "{}"
sudo systemctl start octoprint

Thanks for the quick response. I tried that but had to update the command to:

find /home/pi/oprint/ -type f -iname "*.pyc" -exec rm -fv "{}" \;

But now I'm seeing this error


● octoprint.service - The snappy web interface for your 3D printer
   Loaded: loaded (/etc/systemd/system/octoprint.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2021-04-27 20:47:50 BST; 630ms ago
  Process: 6783 ExecStart=/home/pi/oprint/bin/octoprint serve --host=${HOST} --port=${PORT} (code=exited, status=1/FAILURE)
 Main PID: 6783 (code=exited, status=1/FAILURE)

Apr 27 20:47:50 octopi octoprint[6783]:   File "/home/pi/oprint/lib/python3.7/site-packages/numpy/__init__.py", line 155, in <module>
Apr 27 20:47:50 octopi octoprint[6783]:     from . import polynomial
Apr 27 20:47:50 octopi octoprint[6783]:   File "/home/pi/oprint/lib/python3.7/site-packages/numpy/polynomial/__init__.py", line 118, in <module>
Apr 27 20:47:50 octopi octoprint[6783]:     from .chebyshev import Chebyshev
Apr 27 20:47:50 octopi octoprint[6783]:   File "/home/pi/oprint/lib/python3.7/site-packages/numpy/polynomial/chebyshev.py", line 740
Apr 27 20:47:50 octopi octoprint[6783]:     !# c1, c2 abe trimmE$ copies
Apr 27 20:47:50 octopi octoprint[6783]:                                ^
Apr 27 20:47:50 octopi octoprint[6783]: IndentationError: unindent does not match any outer indentation level
Apr 27 20:47:50 octopi systemd[1]: octoprint.service: Main process exited, code=exited, status=1/FAILURE
Apr 27 20:47:50 octopi systemd[1]: octoprint.service: Failed with result 'exit-code'.

It's starting to look like you have some filesystem corruption going on. You can try to fix the specific numpy error by running:

source ~/oprint/bin/activate
pip3 install numpy --force
deactivate

If more errors pop up I'd suggest re-flashing the SD card.

I reflashed the SD. Using a new one. Thanks for your help.