Documentation "Migrating to Python 3" error after following Note instructions

I followed the note "If you want to migrate your existing OctoPrint install..."
First, I made a backup and downloaded it to my desktop.
Second, I executed "sudo service octoprint stop"
Third, I executed the following:

mv ~/oprint ~/oprint.py2
virtualenv --python=/usr/bin/python3 oprint
source ~/oprint/bin/activate
pip install "OctoPrint>=1.4.0rc1"
sudo service octoprint restart

I then tried to open the web page and got a page "The OctoPrint server is currently not running". As suggested, I executed the command "ps -ef | grep -i octoprint | grep -i python". Nothing is returned.
(I deleted ~/.octoprint/logs/octoprint.log and executed 'sudo service octoprint start')
There is nothing in octoprint.log.

Obviously, I've done something wrong... Can anyone enlighten me (@foosel?)

I rebooted the RPi and now the web page shows up with the caveat "Safe mode is active"
Reason: Problem during last startup

I restarted OctoPrint and all seems well (so far) now to restore the backup...

Is there an octoprint file somewhere within /etc/default or similar and does it indicate Py2 in there?

I'm probably self-referring to this.

With work, I can figure out which version of Python the active OctoPrint is using. I suggest that it appear in the web page(s) in Add Python version to the OctoPrint web interface.

I created this topic because following the published documentation doesn't work, and I'm trying to 1) figure out why and 2) if necessary, get the documentation fixed.

I also appear to be clueless when it comes to using GIT. I did manage to add the

plugin_pythoncompat = ">=2.7,<4"

to my plugin, test it, and even update its GIT repository but I'm having a much more difficult time updating my FanSpeedMirror.md in the plugin repository after adding

compatibility:
python: ">=2.7,<4"

A step by step would be greatly appreciated :thinking:

I'll document my own process on macOS. It might be the same or similar. I'm assuming that you're just going to work in your master branch but I could advise otherwise. I'm also assuming that you only have one remote repository (github).

cd ~/sites/OctoPrint-USBControl
code . # I'm using Visual Studio Code, this would bring up the IDE in this folder
# Make changes to setup.py; updating plugin_version
# Make changes to usbcontrol/__init__.py; __plugin_pythoncompat__
# Make changes to extras/usbcontrol.md; date, octoprint version & python compatibility(!)
# Make changes to README.md; update anything necessary
# Test everything locally
git status # Should show at least four files have changed
git add . # Stage the four files for this commit
git commit -m ":snake: v1.4 Adding Python 3 support"
git tag 1.4
git push
git push --tags

Visit your github repository and verify that the changes have been seen. I'm guessing that this is all that's necessary for things to flow into the plugin listing but @jneilliii has the most experience with this part, I'm sure.

Nope, you need to manually update your own plugin's md file to also include proper python compatibility on plugins.octoprint.org.

It's the file you listed above in extras.

The weird thing is that I tested these exact steps on an OctoPi install and they worked fine here. So that's odd.

It's even more odd that it magically worked after rebooting.

I'll test around a bit today and see if I can reproduce the issue.

That should be

compatibility:
    python: ">=2.7,<4"

Note the indentation. And that should really be all that's to it, adding that. If you already have a compatilibity entry in there you'll need to add just the python line. E.g., say your md file currently already has this:

compatibility:
  octoprint:
    - 1.3.0

then you turn that into

compatibility:
    octoprint:
      - 1.3.0
    python: ">=2.7,<4"

If you clarify what exact issues you are running into with that adjustment I'll also happily help, right now I'm a bit unclear on them :sweat_smile:

The actual FanSpeedMirror.md (1.2 KB) has the proper indentation. I just was sloppy creating this thread. :flushed:

After editing the file, I tried to do what is necessary with GIT commands to get my copy to become your copy and got GIT errors I didn't understand. At some point, the subicons all became green check marks so either I was successful or GIT just gave up.

I'll refresh my memory by looking over your documentation that I used to create the file in the first place and see if I can figure it out. As a 70 year old, "once in a blue moon" plugin author, this old dog sometimes has trouble learning new tricks. :crazy_face:

The steps that did work appeared to create a replacement oprint folder so I took a leap of faith and rebooted. The first reboot came up in Safe Mode (which surprised me) so I rebooted again and now it worked.

I was expecting the FanSpeedMirror plugin to be disabled because while I had added

plugin_pythoncompat = ">=2.7,<4"

to my local repository copy of __init__.py, I didn't think I had updated the one on github. Apparently I not only updated github, the restore fetched the github copy and the plugin worked! :joy:

Just to be sure, you need to update two places. One is your plugin's source code, that's the part that needs the plugin_pythoncompat line added.

The other is the .md file in the plugins.octoprint.org repository, for that you'll need to file a pull request against the repository. So either do a fork, local clone, edit file, commit, push, create PR, or just click the edit icon on the web interface and github will suggest to create a PR from your changes:

Please do not change the publication date though (only mentioning that because I just saw your accidental PR)

Just tried the migration process on OctoPi as described in the docs and it worked flawlessly over here, exactly as written. So I have no idea what happened there, the steps do work this way. Odd.

I think I'm still confused. I have tried again using your latest instructions and I think I did it correctly. I'm sure you will let me know if I did something else wrong :relieved:

Bumping @OllisGit because he was interested in this workflow.

Why are you trying to install the 1.4.0rc1 release when the 1.4.0 has been released publicly?

1 Like

Note how it says ">=1.4.0rc1" - when I wrote the docs 1.4.0 wasn't yet fully released and I wanted to make sure thy also work for RCs. ">=1.4.0rc1" will take whatever is the latest version that is at least 1.4.0rc1 (and thus Python 3 compatible), which currently is 1.4.0.