Upgrading to version-12 ... what about updating bench itself?

Hi @vrms,

TLDR → I believe that Bench now must be installed twice. First as a regular user. Then again as root user.

Explanation:
@bkm and I were discussing this last month. We discovered several challenges during v13 installation.

  • In Bench 4.0 and earlier, the official instructions for installing Bench was using pip’s “editable mode”. This was the 'pip3 install -e .' command.
  • Now, Bench is available on PyPi.org. So we install using pip3 install frappe-bench. This command downloads Bench from PyPi, and installs on our machines.

Here is the problem:

  • Bench sometimes must be root (because it does things with apt, systemd, ansible)
  • Bench sometimes must be a regular user (all the other commands)

Python’s package system can be…painful. Partly because interpretive languages have more moving parts. But also because Python does some magic with symlinks, PATH changes, has no .lock file, virtual environments, etc.

When I installed Bench as a regular user, I could not make it run successfully as root. I tried changing my PATH variables. I even tried manually installing Bench inside a virtual environment. No luck. Even when it appeared like I was successful, Bench would always fail later with a “module not found” error.

Nothing I tried allowed for installing Bench once. But running both as regular and root. :confused:

Recommendations

  1. Until someone provides a workaround, I think the easiest solution for you is installing Bench twice. Once as root, once as a regular user. I think this is awful, but it’s the only solution I have when installing from PyPi.

  2. Alternately, you can still install Bench the old way, in pip’s editable mode. Bench 5.0 will raise warnings about this, and tell you editable mode is not recommended. But it does work.

1 Like