Skip to content

Instantly share code, notes, and snippets.

@esafwan
Created January 12, 2026 09:21
Show Gist options
  • Select an option

  • Save esafwan/b89efdd0c3e3c2304b112b0abb7c4ef9 to your computer and use it in GitHub Desktop.

Select an option

Save esafwan/b89efdd0c3e3c2304b112b0abb7c4ef9 to your computer and use it in GitHub Desktop.
Adding pip Dependencies in a Frappe App or ERPNext the (Correct Way)

Adding pip Dependencies in a Frappe App (Correct Way)

This is the recommended and production-safe way to add Python dependencies to a Frappe app such as google_services.


Preferred Method: pyproject.toml

Open the file:


apps/google_services/pyproject.toml

Add dependencies under the project section:

[project]
dependencies = [
  "requests>=2.31.0"
]

Install dependencies into the bench virtual environment:

bench setup requirements

This approach:

  • Installs dependencies into the bench venv
  • Works across machines, CI, and production
  • Is the current Frappe standard

Alternative (Legacy Apps): requirements.txt

If the app already uses requirements.txt, add:

apps/google_services/requirements.txt
requests>=2.31.0

Then run:

bench setup requirements

What Not to Do

  • Do not run pip install manually
  • Do not install dependencies globally
  • Do not import libraries without declaring them
  • Do not modify bench-level requirements

These approaches will break on redeploy or CI.


How Bench Handles App Dependencies

  • Bench scans all installed apps
  • Reads pyproject.toml or requirements.txt
  • Installs dependencies into the shared virtualenv

Verifying Installation

bench console
import requests
requests.__version__

Recommendation for google_services

For Google Places integration, start with:

dependencies = [
  "requests>=2.31.0"
]

Add additional dependencies only when required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment