How to upgrade to python 3.10

Installing 11 applications...
Installing frappe
$ /home/sagar_p/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/sagar_p/frappe-bench/apps/frappe 
$ yarn install
yarn install v1.22.17
warning ../../package.json: No license field
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
Done in 0.65s.
Installing air_datepicker
$ /home/sagar_p/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/sagar_p/frappe-bench/apps/air_datepicker 
ERROR: 'App' object has no attribute 'tag'
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
  File "/home/sagar_p/.local/lib/python3.10/site-packages/bench/cli.py", line 127, in cli
    bench_command()
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/sagar_p/.local/lib/python3.10/site-packages/bench/commands/update.py", line 59, in update
    update(
  File "/home/sagar_p/.local/lib/python3.10/site-packages/bench/utils/bench.py", line 425, in update
    bench.setup.requirements()
  File "/home/sagar_p/.local/lib/python3.10/site-packages/bench/utils/render.py", line 105, in wrapper_fn
    return fn(*args, **kwargs)
  File "/home/sagar_p/.local/lib/python3.10/site-packages/bench/bench.py", line 449, in requirements
    app = App(path_to_app, bench=self.bench, to_clone=False).install(
  File "/home/sagar_p/.local/lib/python3.10/site-packages/bench/utils/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
  File "/home/sagar_p/.local/lib/python3.10/site-packages/bench/app.py", line 244, in install
    tag=self.tag,
AttributeError: 'App' object has no attribute 'tag'
[quote="rmeyer, post:1, topic:92222, full:true"]
Recently, Frappe [updated its dependencies](https://discuss.frappe.io/t/dropping-python-3-9-support-for-next-version-of-frappe-erpnext/84803?u=rmeyer) for `version-14` to python > 3.10. 

> If you're on `version-13`, try to [upgrade to python3.8](https://discuss.frappe.io/t/how-to-upgrade-erpnext-from-python-3-5-to-3-8/68587/13?u=rmeyer) instead.

Here's what I did to upgrade to python3.10 under Ubuntu 20.04.

> :bangbang: Remember to take a backup of your server first! :bangbang:

Install custom PPA, so Ubuntu knows where to find python3.10:

```bash
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa

Install required python packages:

sudo apt install python3.10 python3.10-dev python3.10-distutils

Switch to your bench directory:

cd /home/frappe/frappe-bench

Move your old python env folder to env-old. This way you make space for the new env while keeping a copy to restore in case something goes wrong.

mv env env-old

Create a new python environment with python3.8

virtualenv --python python3.10 env

In case the above command doesn’t work (I had problems on one machine) you can try this alternative:

# OPTIONAL: only if the above failed
python3.10 -m venv env

Upgrade pip to the newest version. The later commands will fail in case your pip version is too old.

env/bin/pip install -U pip

Now we can reinstall our apps and their dependencies. Here I only show frappe and erpnext. Please append all your custom apps to the command like this: -e apps/my-app

env/bin/pip install -e apps/frappe -e apps/erpnext

I like to run bench update at the end to see if everything worked:

bench update --reset

If everything went well, you can delete your old env (optional, use with care):

rm -rf env-old

Didn’t test this properly yet, but if you get errors from socketio in your browser console, this can possibly be fixed by:

bench setup supervisor
bench restart --supervisor

[/quote]
after => bench update --reset