Python library missing on Frappe Cloud (works locally)

Hi everyone,

I’m running my Frappe App locally without any issues, but on Frappe Cloud I get the following error:

Failed to get method for command climate_edge_app.api.utils.get_user_subscriptions
with No module named 'xlsxwriter'

Here’s what I’ve done to include the library:

  1. Added the required libraries in requirements.txt:
frappe
pandas>=2.8.2
xlrd>=2.0.1
xlwt
fsspec
openpyxl
XlsxWriter
  1. Installed them locally using:
pip install -r requirements.txt
  1. Added the libraries in setup.py as well.
  2. Configured them in the other packaging/config file (forgot the exact filename).
  3. Added the necessary hooks.

Everything works perfectly on my local machine, but Frappe Cloud doesn’t seem to recognize XlsxWriter.

Environment:

  • Ubuntu
  • Python 3.10
  • Latest Frappe version

Does anyone know how to ensure Frappe Cloud installs all the required libraries from requirements.txt and setup files properly? Any advice would be greatly appreciated.

Thanks in advance! :pray:

I believed you should add your dependencies to pyproject.toml this should be locate in your custom apps, if there are none, create a new one.

ERPNext pyproject.toml for reference.

[project]
name = "your-project"
dependencies = [
  "pandas>=2.8.2",
  "xlrd>=2.0.1",
  "xlwt",
  "fsspec",
  "openpyxl",
  "XlsxWriter",
]
3 Likes

Thanks for the suggestion :pray:
Do you mean I should add the dependencies in pyproject.toml in addition to the other places I already added them (requirements.txt, setup.py, and hooks)? Or should I only keep them in pyproject.toml?

For python library dependencies you can maintain it only in pyproject.toml.

requirements.txt is old format an may be obsolete now.

till verison-14 requirement.txt is used.
version-15 onwards pyproject.toml is used for dependencies.

1 Like