Guide to upgrading bench Frappe and ERPNext from v15 to v16 on Debian 12

ERPNext/Frappe v15 to v16 upgrade on Debian 12 — Python 3.14 + Node 24 + Supervisor fix

This is what finally worked for me after getting stuck in bench switch-to-branch version-16 ... --upgrade errors and Supervisor socketio spawn errors.

  • Frappe v16 requires Python 3.14 (or you will get SyntaxError on type X = ...)

  • Frappe v16 should run on Node 24

  • Bench uses the internal venv ~/frappe-bench/env, not whatever venv you manually activate

  • Socketio may fail with ECONNREFUSED 127.0.0.1:11000 unless bench redis processes are running

Make sure you take a snapshot or backup your installation before you start!

1. Install Node 24 (and make sure supervisor can find it)

If you use nvm:

su - <username>
source ~/.bashrc 2>/dev/null || true

nvm install 24
nvm use 24
nvm alias default 24

But supervisor often does NOT load nvm paths, so install Node 24 system-wide too:

curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
sudo apt-get install -y nodejs

2. Install Python 3.14.2 using pyenv

Install build dependencies:

sudo apt update
sudo apt install -y \
  build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \
  libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
  curl git

Install pyenv:

curl https://pyenv.run | bash

Edit ~/.bashrc:

nano ~/.bashrc

Add these lines at the bottom:

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Reload shell:

exec $SHELL

Install + enable Python 3.14.2:

pyenv install 3.14.2
pyenv global 3.14.2
python --version

3. Rebuild bench internal env with Python 3.14

Stop services (important during upgrade)

sudo supervisorctl stop all || true
sudo systemctl stop nginx || true

Bench uses: ~/frappe-bench/env/bin/python

cd ~/frappe-bench
rm -rf ~/frappe-bench/env

python -m venv ~/frappe-bench/env
source ~/frappe-bench/env/bin/activate
python --version              # MUST show 3.14.x

pip install -U pip wheel setuptools
pip install -U frappe-bench

Reinstall core apps (editable):

pip install -e apps/frappe     # ignore dependency warnings if any
pip install -e apps/erpnext    # ignore dependency warnings if any
pip install -e apps/hrms       # ignore dependency warnings if any

4. Switch apps to version-16

cd ~/frappe-bench
source ~/frappe-bench/env/bin/activate

bench switch-to-branch version-16 frappe --upgrade
bench switch-to-branch version-16 erpnext --upgrade
bench switch-to-branch version-16 hrms --upgrade

Then patch update:

bench update --patch

5. Fix Supervisor socketio spawn error (redis_cache not running)

If you get errors like:

  • Service redis_cache is not running

  • socketio spawn error

  • ECONNREFUSED 127.0.0.1 port 11000

Start bench redis + workers FIRST:

sudo supervisorctl start frappe-bench-redis:
sudo supervisorctl start frappe-bench-workers:

Then restart socketio:

sudo supervisorctl restart frappe-bench-web:frappe-bench-node-socketio

Verify everything is running:

sudo supervisorctl status | egrep 'redis|socketio|frappe-web|worker'

Also make sure system redis is enabled (doesn’t hurt):

sudo systemctl enable --now redis-server
sudo systemctl restart redis-server

6. Final update + build + migrate

cd ~/frappe-bench
source ~/frappe-bench/env/bin/activate

bench update --requirements
bench build
bench --site <site> migrate

Restart services:

sudo supervisorctl restart all
sudo systemctl restart nginx
5 Likes

hmmm… when running:

pip install -e apps/frappe

I get the following:

Obtaining file:///home/frappe/frappe-bench/apps/frappe
Installing build dependencies … done
Checking if build backend supports build_editable … done
Getting requirements to build editable … done
Preparing editable metadata (pyproject.toml) … done
INFO: pip is looking at multiple versions of frappe to determine which version is compatible with other requirements. This could take a while.
ERROR: Package ‘frappe’ requires a different Python: 3.14.2 not in ‘<3.14,>=3.10’

Is there something I need to update?

Looks like you have to downgrade python according to the error:

1 Like

It should work with python 3.14.2 because i installed it with that.

Does the install finish or does it stop? check if its installed. i wrote to ignore dependency warnings but i think it was for other things, not python.

It might still work

Thanks for the reply. Downgrading to Python 3.14.0 seemed to do the trick.

Ok it’s very strange. is the server up and running now?

when i check my installation like this:

cd /frappe-bench/apps/frappe

git rev-parse --abbrev-ref HEAD

i get:
version-16

and then i run

grep -n “requires-python” -n pyproject.toml

i get:
7:requires-python = “>=3.14,<3.15”

it should work with v 3.14.2 if your installing v16

If 3.14.2 failed for you, it likely wasn’t really a Python-version incompatibility, but either you were installing a different Frappe checkout whose metadata had <3.14, or pip/build cache / env state.

Your first post stated that the installation wanted SMALLER than 3.14 so downgrading to 3.14 should not have made any difference

Your “3.14.0 worked” is probably a side effect of resetting state

why taking too much time
Ubuntu- 22.04
frappe switched to version-16 in 15 sec
erpnext switch to 16 going on for approach 15 min

We have a command provided by bench to regenerate env using

bench setup env

and to move your existing env to latest use

bench migrate-env /usr/bin/python3.14

I recently upgraded to version 16 from version-14 and it worked smooth for BASE app.

2 Likes

It was probably something with my env still pointing to the v15 requirements or something. This is a test system I have running at the moment so I may try and upgrade back to python 3.14.2 in a day or two.

Thanks for the upgrade guide and the responses!

this is debian 12, not ubuntu 22.04. reinstalling the operating system and configuring a new one takes much longer than copy pasting a few lines of code

i wish i knew this before.

If you want you can make another guide. If i have time i might make a new one because i took zfs snapshots before and after the upgrade.

But thanks!

Yes must have been something like that.

Your welcome!

FYI: My instance is running on Rocky Linux 9.x so there were a few things that were different that I had to work through. However, the majority of your guide worked well.

Yes i bet. I only tried this method on Debian 12 so can’t really say. Just know it’s different from ubuntu where you can simply apt get python

What is reason behind this error

Traceback (most recent call last):
File “/home/cerp/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 138, in get_app_commands
app_command_module = importlib.import_module(f"{app}.commands")
File “/home/cerp/.pyenv/versions/3.14.2/lib/python3.14/importlib/init.py”, line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “”, line 1398, in _gcd_import
File “”, line 1371, in _find_and_load
File “”, line 1314, in _find_and_load_unlocked
File “”, line 491, in _call_with_frames_removed
File “”, line 1398, in _gcd_import
File “”, line 1371, in _find_and_load
File “”, line 1335, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘telephony’
Traceback (most recent call last):
File “/home/cerp/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 138, in get_app_commands
app_command_module = importlib.import_module(f"{app}.commands")
File “/home/cerp/.pyenv/versions/3.14.2/lib/python3.14/importlib/init.py”, line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “”, line 1398, in _gcd_import
File “”, line 1371, in _find_and_load
File “”, line 1314, in _find_and_load_unlocked
File “”, line 491, in _call_with_frames_removed
File “”, line 1398, in _gcd_import
File “”, line 1371, in _find_and_load
File “”, line 1335, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘raven’
Backup failed for Site vulcanglobal.in. Database or site_config.json may be corrupted

You are running into problems with apps like telephony because they do not exist in your new install. I ran into the same problems with drive, insights, whatsapp when trying to upgrade.

Struggled with it for some hours (didn’t get them to install on the new v16) and then decided to restore the snapshot from the beginning when i had a working v15 install. Then removed all apps except frappe, erpnext and hrms. Check that the site is running and working before proceeding. Now the install will proceed without errors for apps like your telephony.

When you have a working v16 install you can try to install the apps again

did it work ?? , i am at this stage and seems like its taking forever

Yes. It would take time but it will work

Thanks for the guide. It worked well on a single site installation, but I am getting Database or site_config.json may be corrupted for my second site. Not sure if MariaDB upgrade happens to all sites. Any difference in multitenant?