Octoprint version unknown, won't start, after python 3 upgrade

Problem.
Used the Octoprint settings UI to upgrade from 1.3.12 to 1.4.2
Upgraded and reloaded without problems.

Next used the code to upgrade the Python to v3. Used this code from the Octoprint upgrade page :

curl -L https://get.octoprint.org/py3/upgrade.py --output upgrade.py
python3 upgrade.py

Complete Logs

Log file log1.zip (9.1 KB)

Additional information about your setup

before python v3 update, was Octoprint 1.4.2
Octopi 0.17.0

Raspberry Pi Model B Rev 1
Connects to Arduino Mega 2560, Marlin
Connect to PC using LAN cable ( not using wifi )

Did the Python upgrade run through successfully? The output of what happened with the script might be very useful here. It seems to me something failed.

As well as this, I'll need you to check a couple of things. It is likely the installation failed. So:

  1. Can you paste the output of ls ~ for me to look at?
  2. Could you then run ~/oprint/bin/python --version and let me know that too? Without the output of the script I am trying to piece together what went wrong and where.

Hi Charlie.
Thanks for the very fast reply.
Output from ~ ls

login as: pi
pi@octopi.local's password:
Linux octopi 4.19.75+ #1270 Tue Sep 24 18:38:54 BST 2019 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Sep 21 16:59:20 2020 from fe80::81ca:15e7:4ad4:cf00%eth0
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'octoprint'

------------------------------------------------------------------------------
Access OctoPrint from a web browser on your network by navigating to any of:

    http://octopi.local
    http://192.168.1.113

https is also available, with a self-signed certificate.
------------------------------------------------------------------------------
This image comes without a desktop environment installed because it's not
required for running OctoPrint. If you want a desktop environment you can
install it via

    sudo /home/pi/scripts/install-desktop
------------------------------------------------------------------------------
OctoPrint version : unknown
OctoPi version    : 0.17.0
------------------------------------------------------------------------------

pi@octopi:~ $ ls ~
bin  mjpg-streamer  OctoPrint  oprint  oprint.bak  pip  scripts  yes
pi@octopi:~ $

and the version output :

login as: pi
pi@octopi.local's password:
Linux octopi 4.19.75+ #1270 Tue Sep 24 18:38:54 BST 2019 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Sep 21 16:59:20 2020 from fe80::81ca:15e7:4ad4:cf00%eth0
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'octoprint'

------------------------------------------------------------------------------
Access OctoPrint from a web browser on your network by navigating to any of:

    http://octopi.local
    http://192.168.1.113

https is also available, with a self-signed certificate.
------------------------------------------------------------------------------
This image comes without a desktop environment installed because it's not
required for running OctoPrint. If you want a desktop environment you can
install it via

    sudo /home/pi/scripts/install-desktop
------------------------------------------------------------------------------
OctoPrint version : unknown
OctoPi version    : 0.17.0
------------------------------------------------------------------------------

pi@octopi:~ $ ls ~
bin  mjpg-streamer  OctoPrint  oprint  oprint.bak  pip  scripts  yes
pi@octopi:~ $ ~/oprint/bin/python --version
Python 3.7.3
pi@octopi:~ $

Maybe just the OctoPrint installation failed then :thinking:, it obviously created a virtual environment .

This section right at the top of your startup section,

  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'octoprint'

suggests to me something went wrong/corrupt with the install. So lets try fix that...

This should install it there: ~/oprint/bin/pip install --force-reinstall --no-cache-dir octoprint

Then to restart the service: sudo service octoprint restart

If that fixes it but your plugins are not there, (since if OctoPrint failed, they may have too) it is possible to recover them from the backup, just don't delete the oprint.bak :wink:

pi@octopi:~ $  ~/oprint/bin/pip install --force-reinstall --no-cache-dir octoprint
-bash: /home/pi/oprint/bin/pip: No such file or directory
pi@octopi:~ $

:thinking: That should be there, (it exists on mine)

Maybe the virtualenv didn't work correctly. You could try running
~/oprint/bin/python -m pip install --force-reinstall --no-cache-dir octoprint
since python at least worked before, although I'm worried it may not have put pip in there entirely.

pi@octopi:~ $ ~/oprint/bin/python -m pip install --force-reinstall --no-cache-dir octoprint
/home/pi/oprint/bin/python: No module named pip
pi@octopi:~ $

and the octoprint was working after the upgrade to version 1.4.2

It only broke after doing the python upgrade

OK lets try a different approach. The old environment is still stored at oprint.bak. So we will restore that, and then try again.

Can you run:

  • mv oprint oprintFAIL (moves py 3 fail out of the way)
  • mv oprint.bak oprint (puts old one back in)
  • then sudo service octoprint restart and check the web interface reloads.

browser UI opened ( slow, but that's normal on my Pi )

Settings is showing Octoprint 1.4.2 and Octopi 0.17.0

now do I run the python upgrade again, and which directory should I be in when using these lines ?

curl -L https://get.octoprint.org/py3/upgrade.py --output upgrade.py
python3 upgrade.py

Shouldn't matter since it uses absolute paths, the home directory is fine. Give it a go and let me know if you get any errors,

after the curl line :

pi@octopi:~ $ curl -L https://get.octoprint.org/py3/upgrade.py --output upgrade.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   154  100   154    0     0    123      0  0:00:01  0:00:01 --:--:--   124
100 24685  100 24685    0     0  11699      0  0:00:02  0:00:02 --:--:--  587k
pi@octopi:~ $

will run the second line now

Thank You Charlie.

Looks like all working now and I can open the browser UI again.

I wonder if the first attempt was broken because I had the browser UI open when doing the python update ?

pi@octopi:~ $ curl -L https://get.octoprint.org/py3/upgrade.py --output upgrade.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   154  100   154    0     0    123      0  0:00:01  0:00:01 --:--:--   124
100 24685  100 24685    0     0  11699      0  0:00:02  0:00:02 --:--:--  587k
pi@octopi:~ $ python3 upgrade.py
OctoPrint Upgrade to Py 3 (v2.1.7)

Hello!
This script will move your existing OctoPrint configuration from Python 2 to Python 3
This script requires an internet connection and it will disrupt any ongoing print jobs.

It will install the latest version of OctoPrint (1.4.2) and all plugins.
No configuration or other files will be overwritten

Press [enter] to continue or ctrl-c to quit

Detecting system info...
OctoPi version: 0.17.0
Getting OctoPrint version...
OctoPrint version: 1.4.2
Reading installed plugins...

Plugins installed
- Floating Navbar
- Pushover
- Sidebar Temp Graph
- Firmware Updater
- Sidebar Order
- Fullscreen Plugin
- M117NavBar
If you think there is something missing from here, please check the list of plugins in Octoprint
Press [enter] to continue or ctrl-c to quit

Root access is required to install python3-dev, please fill in the password prompt if shown
Updating package list...
[sudo] password for pi:
Installing python3-dev...
python3-dev is already the newest version (3.7.3-1).

Creating new Python 3 environment...
/usr/lib/python2.7/dist-packages/virtualenv.py:1090: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp
Successfully created Python 3 environment at /home/pi/oprint

Installing OctoPrint... (This may take a while - Do not cancel!)
Collecting required packages
Installing collected packages
OctoPrint successfully installed!

Downloading OctoPrint's plugin repo

Installing Pushover
Collecting required packages
Installing collected packages
Plugin Pushover successfully installed
Installing OctoPrint-M117NavBar
Collecting required packages
Installing collected packages
Plugin OctoPrint-M117NavBar successfully installed
Installing Fullscreen Webcam
Collecting required packages
Installing collected packages
Plugin Fullscreen Webcam successfully installed
Installing Firmware Updater
Collecting required packages
Installing collected packages
Plugin Firmware Updater successfully installed
Installing OctoPrint-FloatingNavbar
Collecting required packages
Installing collected packages
Plugin OctoPrint-FloatingNavbar successfully installed
Installing OctoPrint-SideBarTempGraph
Collecting required packages
Installing collected packages
Plugin OctoPrint-SideBarTempGraph successfully installed
These plugins were not found on the repo
Please install them manually, from OctoPrint's plugin manager
- sidebarorder

Cleaning up...
Finished! OctoPrint should be ready to go
Once you have verified the install works, you can safely remove the folder /home/pi/oprint.bak
If you want to go back (If it doesn't work) to Python 2 download the file at:
https://raw.githubusercontent.com/cp2004/Octoprint-Upgrade-To-Py3/master/go_back.py
pi@octopi:~ $




login as: pi
pi@octopi.local's password:
Linux octopi 4.19.75+ #1270 Tue Sep 24 18:38:54 BST 2019 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Sep 21 17:38:39 2020 from fe80::81ca:15e7:4ad4:cf00%eth0

------------------------------------------------------------------------------
Access OctoPrint from a web browser on your network by navigating to any of:

    http://octopi.local
    http://192.168.1.113

https is also available, with a self-signed certificate.
------------------------------------------------------------------------------
This image comes without a desktop environment installed because it's not
required for running OctoPrint. If you want a desktop environment you can
install it via

    sudo /home/pi/scripts/install-desktop
------------------------------------------------------------------------------
OctoPrint version : 1.4.2
OctoPi version    : 0.17.0
------------------------------------------------------------------------------

pi@octopi:~ $





Could have been anything really, maybe a bad download by Python/pip, maybe something felt like it was having a bad day. The browser UI should not stop it since the service is stopped first thing.

Enjoy OctoPrint on Python 3, you might feel some of the performance improvements more on an original Pi B!

1 Like

Thanks again Charlie.

I really appreciate the assistance.

Not sure which post to mark as 'solution' ( as it was a multi-step process ) so will mark this as the solution at the end of the process.

2 Likes