Octo print not loading

What is the problem?

Octoprint wont start. I get the The OctoPrint server is currently not running message.

What did you already try to solve it?

ps -ef | grep -i octoprint | grep -i python shows no process running. Log shows an error with a filament sensor plug in

Have you tried running in safe mode?

yes but it wont go into safemode.

Traceback (most recent call last):
  File "/home/pi/oprint/bin/octoprint", line 8, in <module>
    sys.exit(main())
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/__init__.py", line 908, in main
    from click.utils import get_os_args
  File "/home/pi/oprint/lib/python3.7/site-packages/click/__init__.py", line 7, in <module>
    from .core import Argument as Argument
  File "/home/pi/oprint/lib/python3.7/site-packages/click/core.py", line 3, in <module>
    import inspect
  File "/usr/lib/python3.7/inspect.py", line 35, in <module>
    import dis
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 724, in exec_module
  File "<frozen importlib._bootstrap_external>", line 857, in get_code
  File "<frozen importlib._bootstrap_external>", line 525, in _compile_bytecode
ValueError: bad marshal data (invalid reference)

Did running in safe mode solve the problem?

nope

Systeminfo Bundle

You can download this in OctoPrint's System Information dialog ... no bundle, no support!)
no accessable

Additional information about your setup

OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible
pi 3b+ on an ender 3 pro
OctoPrint version : 1.8.1
OctoPi version : 0.18.0

You may try a quick reinstall first, to see if that helps fix the issue. This kind of error is one that sometimes comes with some sort of corruption.

1 Like

Aww that's a bummer. I will look at getting a new SD card and getting that up and running. Is there a way to pull all my settings, config, plugin's etc? bear in mind i cant start the service. is there a way i can fix it enough to make it work and grab a backup?

Did you try the reinstall? There is no loss of data with this process that is linked in my first post.

It does look like something lower down than that would fix, but it is worth a try.

If you could fix it enough to make it work... It would be working and would not need any further fixing.

Hi Charlie, I figured a reinstall would lose the data i would ideally want to keep. I have tried the reinstall tonight and it also failed. here is the output on the terminal.

pi@octopi:~ $ ~/oprint/bin/pip install --force-reinstall OctoPrint==1.8.1 --no-cache-dir
Traceback (most recent call last):
  File "/home/pi/oprint/bin/pip", line 6, in <module>
    from pip._internal.cli.main import main
  File "/home/pi/oprint/lib/python3.7/site-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/home/pi/oprint/lib/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/home/pi/oprint/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/home/pi/oprint/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py", line 25, in <module>
    from pip._internal.cli.progress_bars import BAR_TYPES
  File "/home/pi/oprint/lib/python3.7/site-packages/pip/_internal/cli/progress_bars.py", line 12, in <module>
    from pip._internal.utils.logging import get_indentation
  File "/home/pi/oprint/lib/python3.7/site-packages/pip/_internal/utils/logging.py", line 18, in <module>
    from pip._internal.utils.misc import ensure_dir
  File "/home/pi/oprint/lib/python3.7/site-packages/pip/_internal/utils/misc.py", line 21, in <module>
    from pip._vendor import pkg_resources
  File "/home/pi/oprint/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 41, in <module>
    import inspect
  File "/usr/lib/python3.7/inspect.py", line 35, in <module>
    import dis
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 724, in exec_module
  File "<frozen importlib._bootstrap_external>", line 857, in get_code
  File "<frozen importlib._bootstrap_external>", line 525, in _compile_bytecode
ValueError: bad marshal data (invalid reference)

I did a apt purge python 3 and apt autoremove. The reinstalled it. I then did an update and upgrade then tried the octoprint rebuild again and got the following output.

pi@octopi:~ $ ~/oprint/bin/pip install --force-reinstall OctoPrint==1.8.1 --no-cache-dir
Traceback (most recent call last):
  File "/home/pi/oprint/bin/pip", line 6, in <module>
    from pip._internal.cli.main import main
  File "/home/pi/oprint/lib/python3.7/site-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/home/pi/oprint/lib/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/home/pi/oprint/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/home/pi/oprint/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py", line 18, in <module>
    from distutils.util import strtobool
  File "/home/pi/oprint/lib/python3.7/distutils/__init__.py", line 25, in <module>
    from distutils import dist, sysconfig
ImportError: cannot import name 'dist' from 'distutils' (/home/pi/oprint/lib/python3.7/distutils/__init__.py)

How did you figured out?

it just means i thought i would lose the data but i havent. I have resolved my issue. Will explain in a moment.

1 Like

So after my previous post I had an import error. To resolve this I run the following command
sudo apt install python3-distutils Which installed distutils. I then run the repair command in charlies guide above. This then repaired the installation successfully. It then asked to update pip which i did with

Finally I rebooted the service with sudo service octoprint restart

This gave me the logon screen and I am now pulling a backup. I will be replacing my SD card as this is not the first time i have had a corruption and then i can restore my back up to it.

Thanks for your help @charlie

2 Likes