frappe / hrms

Open Source HR and Payroll Software
https://frappe.io/hr
GNU General Public License v3.0
1.39k stars 730 forks source link

HR module installation not working with frappe_docker #1296

Closed mzenz closed 10 months ago

mzenz commented 10 months ago

Information about bug

Attempting to install the hrms module after starting the frappe_docker throws an error:

ModuleNotFoundError: No module named 'hrms'

Steps to reproduce

Result

Frontend errors out saying ModuleNotFoundError: No module named 'hrms'.

Module

HR

Version

Installation method

docker

Relevant log output / Stack trace / Full Error Message.

s={}, method=<function build_index_for_all_routes at 0x7fbe95b189a0>, site='frontend', user='Administrator') (frontend::ad3a1707-ea78-4f05-b2ed-b308452b7285)
2024-01-10 21:07:11,186 [Job frontend::ad3a1707-ea78-4f05-b2ed-b308452b7285]: exception raised while executing (frappe.utils.background_jobs.execute_job)
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/rq/worker.py", line 1428, in perform_job
    rv = job.perform()
         ^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/rq/job.py", line 1278, in perform
    self._result = self._execute()
                   ^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/rq/job.py", line 1315, in _execute
    result = self.func(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 190, in execute_job
    frappe.connect(site)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 279, in connect
    init(site)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 258, in init
    setup_module_map()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1620, in setup_module_map
    for module in get_module_list(app):
                  ^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1479, in get_module_list
    return get_file_items(get_app_path(app_name, "modules.txt"))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1444, in get_app_path
    return get_pymodule_path(app_name, *joins)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1474, in get_pymodule_path
    return abspath(join(dirname(get_module(scrub(modulename)).__file__ or ""), *joins))
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1415, in get_module
    return importlib.import_module(modulename)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'hrms'


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
mzenz commented 10 months ago

Btw, the instructions on switching hrms to the version-15 branch came from this issue: https://github.com/frappe/hrms/issues/1244

indra151096 commented 10 months ago

UP UP

same issue here

indra151096 commented 10 months ago

after I read about this

https://github.com/frappe/frappe_docker/wiki/Frequently-Asked-Questions#how-to-install-official-or-custom-apps

I just realized that we can't install hr using bench get-app inside running docker container. As per the FaQ, we need to create custom image that contains frappe hr inside then deploy the container.

because when we use bench get-app and bench build, the asset will not load properly as well, the symlink will be gone inside asset folder.

mzenz commented 10 months ago

I followed the instructions from https://github.com/frappe/frappe_docker/blob/main/docs/custom-apps.md and successfully built a custom image that includes the hrms module.

Going by the build command's output, the hrms module seems to be installed correctly. After modifying pwd.yml with the image name custom_build/erpnext:1.0.0 and running the image stack via docker compose -f pwd.yml up, logging into the frontend container shows the hrms module installed under apps directory.

Still, after logging into ERPNext for the first time, the hrms module/app is nowhere to be found.

Can someone tell us if there are any other missing steps to get it activated?

Customized apps.json

[
  {
    "url": "https://github.com/frappe/erpnext.git",
    "branch": "version-15"
  },
  {
    "url": "https://github.com/frappe/hrms.git",
    "branch": "version-15"
  }
]

Build command

docker build \
  --build-arg=FRAPPE_PATH=https://github.com/frappe/frappe \
  --build-arg=FRAPPE_BRANCH=version-15 \
  --build-arg=PYTHON_VERSION=3.11.6 \
  --build-arg=NODE_VERSION=18.18.2 \
  --build-arg=APPS_JSON_BASE64=`base64 -w 0 development/apps.json` \
  --tag=custom_build/erpnext:1.0.0 \
  --file=images/custom/Containerfile .
acuteangleTech commented 1 month ago

can you share the image

zynnthen commented 1 month ago

@mzenz can share your step? how you install and activate the feature

MetatronsCube commented 2 weeks ago

i have the same issue on mac OS