Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

[Tutorial] Installing and Upgrading Bench CLI (ver. 5.3)

Hello,

Since there seems to be a lot of confusion around how to correctly install bench, I’ve decided to write a tutorial about it.


Prerequisites

pip3 (Python 3 package installer) needs to be installed on your machine. You can try running the following command to see if it’s available:

pip3 --version

On Debian-based systems (this includes Ubuntu and Ubuntu flavoured OSes), pip3 can be installed by running the following command:

sudo apt install python3-pip

Removing existing installation(s)

Before v5, bench used to be installed in an editable mode. Or maybe you installed the package from PyPI in the user directory. In any case, run the following commands if you want to start afresh.

pip3 uninstall frappe-bench # Removes bench from the user directory
sudo -H pip3 uninstall frappe-bench # Removes bench installed globally

If you used Python 2 for an earlier installation of bench, run the above commands with a slight modification: replace pip3 with the pip executable.

After this, in case you had earlier installed bench in editable mode, you can safely remove the cloned bench repository.


Installing bench

It is important to note that bench does not need to be installed twice. Since it sometimes need to be run as root (using sudo), it needs to be installed system-wide. Like any other executable installed system-wide, bench will still be accessible as a regular user.

sudo -H pip3 install frappe-bench

That’s it! bench should now be installed. You can test that by running the following:

bench --version

Upgrading bench

Like any other package installed using pip3, you can upgrade bench easily by running the following command:

sudo -H pip3 install --upgrade frappe-bench

Further reading

4 Likes