Upgade 5.2 to 6

Is there a step-by-step upgrade guide from 5.2 to 6? I'm not really getting anywhere with Upgrading Plone 5.2 to 6.0 – Backend – Plone Upgrade Guide – Version-specific migration procedures and tips — Plone Documentation v6.0.

What happens?

Did you try to install a new Plone 6 and then copy the old var folder to the new one

Off topic: What is the reason for upgrading? Is 6 faster than 5.2.11 in classic mode ?

We are now running Plone 5.2 on Debian 11. I would like to do an inplace upgrade.

Sooner or later plone will not support debian11, pyhton 2.7, etc....., so better upgrade now and be up to date before it is too late.

So far we have changed the buildout configuration to upgrade, but this now ends in an error when we try to upgrade to 6.0

While:
Initializing.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
File "/opt/plone/zinstance/local/lib/python2.7/site-packages/zc/buildout/buildout.py", line 2173, in main
user_defaults, command, args)
File "/opt/plone/zinstance/local/lib/python2.7/site-packages/zc/buildout/buildout.py", line 370, in init
data_buildout_copy, override, set()))
File "/opt/plone/zinstance/local/lib/python2.7/site-packages/zc/buildout/buildout.py", line 1826, in _open
downloaded))
File "/opt/plone/zinstance/local/lib/python2.7/site-packages/zc/buildout/buildout.py", line 1802, in _open
fp, filename_for_logging, _default_globals)
File "/opt/plone/zinstance/local/lib/python2.7/site-packages/zc/buildout/configparser.py", line 188, in parse
section_condition = eval(expr, context)[0]
File "", line 1, in
NameError: name 'python38' is not defined

You may need to use a newer Python version. Supported Python versions are 3.8, 3.9, 3.10, and 3.11.

Please read the upgrade guide thoroughly and/or contact a Plone solution provider of your choice if time is of the essence.

I recently did a similar upgrade, and you are supposed to upgrade to python 3 at the 5.2 level before going to Plone 6.

I went from 5.1.6 to 5.2.10 (5.2.10 seems to be the last version that can install python 2.7 as part of the unified installer)

Once at 5.2.10 with python 2.7 I made a second 5.2.10 install that used python 3.8 and followed the steps in this doc to upgrade my zodb database
https://docs.plone.org/manage/upgrading/version_specific_migration/upgrade_zodb_to_python3.html

  • Prepare Your Buildout For Migrating The Database To Python 3
  • Verify The Integrity of the Database in Python 2
  • Migrate Database using zodbupdate

Once at 5.2.10 python3, I tried to go right to Plone 6 but ended up having to go back and upgrade to 5.2.11 first. You are already at this level, so i'm guessing you want to go 5.2.11 with python 2.7 -> 5.2.11 with python 3 -> Plone 6

Just one side note. I decided to stay at 5.2.11 with Python 3.8 for now, as I did not like the changes to the classic interface (mainly album thumbnails missing) and I was not ready to research volto. But it is good to know when I do need to go to v6, that this upgrade will work. I think my plone site started at either v2 or v3, so I ran into a lot of odd issues I had to work around for the python 2 to python 3 upgrade

Also, one other note. the guide for upgrading the zodb from python 2 to 3 has this note

Do not try to start Plone in Python 3 with the old database before migrating it! Trying to that will destroy the database and result in a traceback like this:

So if you have already tried to start that database without upgrading it, you might have to go back to a previous copy of it. (though from your error it looks like you didn't have python 3.8 installed, so maybe it didn't get far enough to harm the database)


As someone not developing my own plugins I found the 5.2 to 6.0 guide you mentioned fairly useless. it was one of the first things I looked at, but It really did not help my upgrade at all. it seems more like a "whats changed" guide than an upgrade guide.

seriously. is that link a joke or something? where are the upgrade instructions? what are we supposed to run instead of buildout? why are we running make build-backend, make start-backend, and where are those commands?

Python 2.7 will be around for a while: GitHub - ActiveState/cpython: The Python programming language. Today's version is 2.7.18.10, updated 2 weeks ago.

This is a bit misleading: it assumes that you are actually using (and likely building your own build of) ActiveState's Python 2.7 fork, and I'm going to make a solid bet that most organizations using Python 2.7 are not, plus:

  • you still have a cliff of Plone 5.2 EoL
  • there is a tremendous opportunity cost to staying on a version of Python that has been mainline-end-of-life for years now — this is a high-interest form of technical debt that will make you cry later if you plan to maintain any system for more than months
  • you should absolutely only continue use of Python 2.7 as a last resort
2 Likes

Yes @seanupton, it assumes that you are actually using ActiveState's Python 2.7 fork. There's absolutely nothing wrong with that. Building Python 2.7 from source is easy. It's useful to be able to do that as an organization that uses Debian, like the person asking the question. Plone 5.2 won't suddenly become unusable and/or unsafe after its EOL.

Could you please explain how you upgraded to 6?

From 5.2.11 on python 3, did you simply change the version in your buildout.cfg, run buildout, and bin/instance fg, like you would if you were just doing a minor version upgrade?

Some thoughts:

  • I'm going out on a limb to suggest you don't want to upgrade to Volto UI, and you should, based on your goals to keep this simple, use Classic UI
  • you should not upgrade your build in place for a major upgrade, in my opinion:
    • your build should be in version control
    • you should clone your build to another directory to work on upgrade work
    • you should make a branch for your upgrade work

general steps involved

Before you upgrade:

  • Make sure your existing Plone 5.2 is successfully running on Python 3.8 (and therefore using WSGI, not using ZServer)
  • -- OR -- if you plan to use collective.exportimport to move all your content from a Python 2.7-based Plone 5, you may need to make significant changes to a Plone 6 build (to remove old custom pins) or make a fresh build inspired by what you already have.

general upgrade steps I would suggest following:

  • Upgrading Plone 6 (Classic UI) (via pyenv-installed-Python, venv, buildout):
    • Install pyenv (via homebrew on macOS, or via pyenv-installer on Linux)
    • Install latest Python 3.12 (for Plone 6.1) via pyenv
    • Find the release notes for the Plone version you are using, and make sure you have a requirements.txt in the root of your buildout dirwith versions recommended for setuptools, pip, wheel, zc.buildout
    • Make a venv called env in your build with python -m venv env
    • Install all the packages in the requirements.txt with pip in your virtualenv
    • Update your buildout version pins to use the URL to (or downloaded copies of) Plone versions.cfg pins on dist.plone.org
    • Make sure any version pins you have for things not in Plone core (e.g. things your add-ons depend on) are updated to recent versions compatible with recent Python 3.x
    • Test running your build; if things fail, figure out why (e.g. a version pin needs an update, or an add-on you make or use needs a tweak)
    • If your build succeeds, test starting (zeo and) Plone / Zope instance
      • fix anything that breaks start-up in your add-ons
      • fix anything deprecation warnings indicate, if you can
    • If your Zope/Plone starts, create an empty test site and install your theme, add-ons, and/or site-policy product packages into it
      • adjust things as needed; how much work this is is wildly YMMV based on complexity of your previous install
    • Once you have an empty site working:
      • import your content via collective.exportimport (if you don't want to upgrade in place)
      • or copy over your Data.fs, restart zeo, and attempt in-place upgrade per documentation)

misc notes

  • Other stuff, re: add-ons:
    • if your add-ons are set up as old-style namespace packages, you will need to update both setup.py (remove namespace_packages value) and the namespace init.py to use pkgutil, not pkg_resources
    • The Plone Site itself is now content, if you want to exclude it from catalog queries (or event subscribers) made by code in your add-ons, explicitly make that exception.
    • Look at deprecation messages when starting Plone, you may move a bunch of imports from Products.CMFPlone to plone.base (if your roadmap is upgrading directly to 6.1).
  • if you have a Diazo theme for your Plone 5.2 site, there may be other steps needed to accommodate changes in markup and assumptions around updates to Barceloneta (if you have a theme based on Barceloneta). If you use stock theme, you can ignore this (with the caveat that if you use @@custom_css you may need to make tweaks to that).
  • if you have any customizations of JavaScript resources in your add-ons, you may need to invest some time porting these to new assumptions about resource registry (AMD/requirejs is gone, thankfully)
1 Like

So just to be clear, I'm still running bin/buildout ?

Also when I do run buildout in a copy of my dev directory, it's still referencing the original directory - is there a path I need to edit in a file somewhere?

Thanks!

beware of the python version, it is better you create a new virtualenv, install buildout and other useful things, and then copy buildout.cfg (also base.cfg and so on), run it, and then copy var/filestorage and var/blogstorage from the actual server to dev.

You can use, for example, pyenv to manage python versions and virtualenvs.

To install a python environment for Plone:

  • install a python version (see pydev above, for example)
  • with the python version above, create a virtualenv
  • inside the virtualenv, do:
    pip install -r https://dist.plone.org/release/6.0.13/requirements.txt

and you've your local buildout to start with. Then use it with buildout.cfg, remember to change all the references on Plone 5.2 to Plone 6.