Hi!
I had the same problem, but in a development environment. If you’re migrating, make sure your app is also up to date.
I solved it by reinstalling each app:
env/bin/pip install -e apps/frappe -e apps/erpnext
You can follow this guide for more information:
How to Upgrade Python 3.10