Frappe Bench
Frappe Bench is a command-line interface (CLI) tool designed to manage multi-tenant deployments of Frappe apps and ERPNext. It handles tasks like initializing new benches, creating sites, installing apps, updating, and configuring services like Nginx and Supervisor. The current version is 5.29.1, with frequent patch and minor releases addressing bug fixes and improvements.
Common errors
-
ModuleNotFoundError: No module named 'pkg_resources'
cause Newer versions of `setuptools` (>=82) have removed `pkg_resources`, which is a dependency for some Frappe components or integrations (like Dropbox).fixEnsure `frappe-bench` is updated to at least 5.29.1, which includes a fix to limit `setuptools` version. If the problem persists, manually run `pip install 'setuptools<82'` inside your bench's virtual environment. -
Error: Python 3.9.x is not supported by frappe-bench. Please use Python 3.10 or higher.
cause The Python version used to run `bench init` or other `bench` commands is older than the required Python 3.10.fixInstall Python 3.10 or newer on your system. Activate an environment with the correct Python version before running `bench` commands, or specify it explicitly with `bench init --python /path/to/python3.10`. -
nginx: [emerg] unknown directive "ssl_stapling" in /etc/nginx/conf.d/your_site.conf
cause Your Nginx configuration still contains `ssl_stapling` or `ssl_stapling_verify` directives, which have been removed from the default Bench Nginx template in recent versions.fixRun `bench setup nginx` to regenerate the Nginx configuration. If you have custom Nginx settings, manually remove these deprecated directives from your config files. -
Error: App name not found in setup.py for app 'your_app_name'.
cause Frappe Bench could not correctly parse the app's package name from its `setup.py` file, usually because the `name` field is missing or malformed.fixVerify that your app's `setup.py` file explicitly defines the `name` field, e.g., `setup(name='your_app_name', ...)`.
Warnings
- breaking Frappe Bench now explicitly requires Python 3.10 or newer. Older Python versions will result in installation failures or runtime errors.
- gotcha Errors like `ModuleNotFoundError: No module named 'pkg_resources'` can occur during site setup or app installation due to conflicts with newer `setuptools` versions. Bench itself attempts to mitigate this.
- deprecated The `ssl_stapling` and `ssl_stapling_verify` directives have been removed from the default Nginx configuration template because Let's Encrypt no longer provides OCSP responses.
- gotcha App installation may fail if the app's `setup.py` file does not contain a correctly parsed `name` field, leading to an 'App name not found' error.
Install
-
pip install frappe-bench
Imports
- bench_command
This is primarily a CLI tool. Direct Python imports are not common for end-users; it's typically invoked via the `bench` command in the terminal.
Quickstart
# 1. Install Frappe Bench (ensure Python >= 3.10 is active) pip install frappe-bench # 2. Initialize a new bench directory bench init frappe-bench --python `which python3` --frappe-branch main # 3. Change into the new bench directory cd frappe-bench # 4. Get an app (e.g., Frappe framework itself) bench get-app frappe https://github.com/frappe/frappe.git --branch main # 5. Create a new site bench new-site site1.local # 6. Install the app on the new site bench --site site1.local install-app frappe # 7. Start the bench in development mode (optional) # bench start