Install of ERPNext With Bench Fails | No module named 'frappe.website.render'

I have a Debian 11 server that I am trying to install ERPNext on. I have been referring to the docs for the Manual Install from this:

When setting up the individual environment for bench, once mysql and dependencies are installed, I get snagged on missing module in ERPNext. I have tried reinstalling in multiple ways. I am not sure if I am missing a step or what.

python3 -m venv .

source bin/activate

pip3 install frappe-bench

bench --version
5.8.1

init erpnext

bench init erpnext

bench new-site site.com

cd erpnext/

bench new-site site.com

cd sites/site.com

pip install braintree~=4.8.0

pip install googlemaps~=4.4.5

pip install pycryptodome~=3.10.1

bench get-app --branch version-12 erpnext


Getting erpnext
$ git clone https://github.com/frappe/erpnext.git --branch version-12 --depth 1 --origin upstream
Cloning into 'erpnext'...
remote: Enumerating objects: 6188, done.
remote: Counting objects: 100% (6188/6188), done.
remote: Compressing objects: 100% (5084/5084), done.
remote: Total 6188 (delta 1139), reused 5007 (delta 978), pack-reused 0
Receiving objects: 100% (6188/6188), 17.82 MiB | 7.45 MiB/s, done.
Resolving deltas: 100% (1139/1139), done.
Installing erpnext
$ /srv/bench2/erpnext/env/bin/python -m pip install --quiet --upgrade -e /srv/bench2/erpnext/apps/erpnext 
$ yarn install
yarn install v1.22.18
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 0.14s.
$ bench build --app erpnext
✔ Application Assets Linked                                                                                    


yarn run v1.22.18
$ node esbuild --production --apps erpnext --run-build-command
File                                                        Size

 DONE  Total Build Time: 513.274ms

clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
 WARN  Cannot connect to redis_cache to update assets_json
 WARN  Cannot connect to redis_cache to update assets_json
 WARN  Cannot connect to redis_cache to update assets_json
Done in 17.79s.


../../env/bin/pip install -e ../../apps/erpnext/

Obtaining file:///srv/bench2/erpnext/apps/erpnext
  Preparing metadata (setup.py) ... done
Requirement already satisfied: braintree==3.57.1 in ./env/lib/python3.9/site-packages (from erpnext==12.30.1) (3.57.1)
Requirement already satisfied: gocardless-pro==1.11.0 in ./env/lib/python3.9/site-packages (from erpnext==12.30.1) (1.11.0)
Requirement already satisfied: googlemaps==3.1.1 in ./env/lib/python3.9/site-packages (from erpnext==12.30.1) (3.1.1)
Requirement already satisfied: pandas<1.2.0,>=0.24.0 in ./env/lib/python3.9/site-packages (from erpnext==12.30.1) (1.1.5)
Requirement already satisfied: plaid-python~=7.2.1 in ./env/lib/python3.9/site-packages (from erpnext==12.30.1) (7.2.1)
Requirement already satisfied: PyGithub==1.44.1 in ./env/lib/python3.9/site-packages (from erpnext==12.30.1) (1.44.1)
Requirement already satisfied: python-stdnum==1.12 in ./env/lib/python3.9/site-packages (from erpnext==12.30.1) (1.12)
Requirement already satisfied: Unidecode==1.1.1 in ./env/lib/python3.9/site-packages (from erpnext==12.30.1) (1.1.1)
Requirement already satisfied: pycryptodome==3.9.8 in ./env/lib/python3.9/site-packages (from erpnext==12.30.1) (3.9.8)
Requirement already satisfied: requests<3.0,>=0.11.1 in ./env/lib/python3.9/site-packages (from braintree==3.57.1->erpnext==12.30.1) (2.25.1)
Requirement already satisfied: six in ./env/lib/python3.9/site-packages (from gocardless-pro==1.11.0->erpnext==12.30.1) (1.16.0)
Requirement already satisfied: deprecated in ./env/lib/python3.9/site-packages (from PyGithub==1.44.1->erpnext==12.30.1) (1.2.13)
Requirement already satisfied: pyjwt in ./env/lib/python3.9/site-packages (from PyGithub==1.44.1->erpnext==12.30.1) (2.0.1)
Requirement already satisfied: pytz>=2017.2 in ./env/lib/python3.9/site-packages (from pandas<1.2.0,>=0.24.0->erpnext==12.30.1) (2021.1)
Requirement already satisfied: python-dateutil>=2.7.3 in ./env/lib/python3.9/site-packages (from pandas<1.2.0,>=0.24.0->erpnext==12.30.1) (2.8.2)
Requirement already satisfied: numpy>=1.15.4 in ./env/lib/python3.9/site-packages (from pandas<1.2.0,>=0.24.0->erpnext==12.30.1) (1.22.4)
Requirement already satisfied: chardet<5,>=3.0.2 in ./env/lib/python3.9/site-packages (from requests<3.0,>=0.11.1->braintree==3.57.1->erpnext==12.30.1) (4.0.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./env/lib/python3.9/site-packages (from requests<3.0,>=0.11.1->braintree==3.57.1->erpnext==12.30.1) (1.26.9)
Requirement already satisfied: idna<3,>=2.5 in ./env/lib/python3.9/site-packages (from requests<3.0,>=0.11.1->braintree==3.57.1->erpnext==12.30.1) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in ./env/lib/python3.9/site-packages (from requests<3.0,>=0.11.1->braintree==3.57.1->erpnext==12.30.1) (2022.5.18.1)
Requirement already satisfied: wrapt<2,>=1.10 in ./env/lib/python3.9/site-packages (from deprecated->PyGithub==1.44.1->erpnext==12.30.1) (1.14.1)
Installing collected packages: erpnext
  Attempting uninstall: erpnext
    Found existing installation: erpnext 12.30.1
    Uninstalling erpnext-12.30.1:
      Successfully uninstalled erpnext-12.30.1
  Running setup.py develop for erpnext
Successfully installed erpnext-12.30.1



bench --site site.com install-app erpnext


Installing erpnext...
Updating DocTypes for erpnext       : [                                        ] 0%An error occurred while installing erpnext: Module import failed for Period Closing Voucher (erpnext.accounts.doctype.period_closing_voucher.period_closing_voucher Error: No module named 'frappe.website.render')
Traceback (most recent call last):
  File "apps/frappe/frappe/modules/utils.py", line 235, in load_doctype_module
    doctype_python_modules[key] = frappe.get_module(module_name)
  File "apps/frappe/frappe/__init__.py", line 1243, in get_module
    return importlib.import_module(modulename)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "apps/erpnext/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py", line 9, in <module>
    from erpnext.controllers.accounts_controller import AccountsController
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 11, in <module>
    from erpnext.stock.get_item_details import get_conversion_factor, get_item_details
  File "apps/erpnext/erpnext/stock/get_item_details.py", line 14, in <module>
    from erpnext.stock.doctype.item.item import get_item_defaults, get_uom_conv_factor
  File "apps/erpnext/erpnext/stock/doctype/item/item.py", line 14, in <module>
    from erpnext.setup.doctype.item_group.item_group import (get_parent_item_groups, invalidate_cache_for)
  File "apps/erpnext/erpnext/setup/doctype/item_group/item_group.py", line 11, in <module>
    from frappe.website.render import clear_cache
ModuleNotFoundError: No module named 'frappe.website.render'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "apps/frappe/frappe/commands/site.py", line 417, in install_app
    _install_app(app, verbose=context.verbose, force=force)
  File "apps/frappe/frappe/installer.py", line 279, in install_app
    sync_for(name, force=force, reset_permissions=True)
  File "apps/frappe/frappe/model/sync.py", line 96, in sync_for
    import_file_by_path(
  File "apps/frappe/frappe/modules/import_file.py", line 145, in import_file_by_path
    import_doc(
  File "apps/frappe/frappe/modules/import_file.py", line 242, in import_doc
    doc.insert()
  File "apps/frappe/frappe/model/document.py", line 268, in insert
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1071, in run_post_save_methods
    self.run_method("on_update")
  File "apps/frappe/frappe/model/document.py", line 912, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1251, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1233, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 909, in fn
    return method_object(*args, **kwargs)
  File "apps/frappe/frappe/core/doctype/doctype/doctype.py", line 399, in on_update
    self.run_module_method("on_doctype_update")
  File "apps/frappe/frappe/core/doctype/doctype/doctype.py", line 485, in run_module_method
    module = load_doctype_module(self.name, self.module)
  File "apps/frappe/frappe/modules/utils.py", line 237, in load_doctype_module
    raise ImportError(
ImportError: Module import failed for Period Closing Voucher (erpnext.accounts.doctype.period_closing_voucher.period_closing_voucher Error: No module named 'frappe.website.render')

Hi, when you’re running bench init erpnext it is default to develop branch of frappe which is not compatible with version 12. This can be correct with
bench init --frappe-branch version-12 erpnext

Since you’ve already setup your bench you can run
bench switch-to-branch version-12 frappe
bench setup requirements --python
bench setup requirements --node

Then setup your new site.

1 Like

Whelp. I’m glad it was that simple. I have been able to proceed with the install using the provided command.