frappe / payments

A payments app for frappe
MIT License
72 stars 196 forks source link

No module named 'payments' on ERPNext v14.24.1 #31

Open Llewellynvdm opened 1 year ago

Llewellynvdm commented 1 year ago

So the system runs on v14.24.1 and works well, but when I want to Enable Checkout (I get internal site error):

image

So this is what I did...

I run the following commands in my dockerised containerised system:

docker compose --project-name account-vdm-proxy exec backend bench get-app payments --resolve-deps

I get the following warning (see last line):

Following apps will be installed
1. payments 
Getting payments
$ git clone https://github.com/frappe/payments.git   --origin upstream
Cloning into 'payments'...
remote: Enumerating objects: 1619, done.
remote: Counting objects: 100% (478/478), done.
remote: Compressing objects: 100% (158/158), done.
remote: Total 1619 (delta 352), reused 386 (delta 314), pack-reused 1141
Receiving objects: 100% (1619/1619), 298.32 KiB | 2.64 MiB/s, done.
Resolving deltas: 100% (853/853), done.
Installing payments
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/payments 
$ bench build --app payments
✔ Application Assets Linked                                                                                                                       

yarn run v1.22.19
$ node esbuild --production --apps payments --run-build-command
File                                                        Size

 DONE  Total Build Time: 384.396ms

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
Done in 0.96s.
WARN: restart failed: Couldn't find supervisorctl in PATH

I then go-head to install the plugin anyway with the following:

docker compose --project-name account-vdm-proxy exec backend bench --site account.vdm.proxy install-app payments

image

All seems to be a success, but then I get the Internal Server Error page.

When I check the backend log of the container I see the following:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/gunicorn/workers/gthread.py", line 271, in handle
    keepalive = self.handle_request(req, conn)
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/gunicorn/workers/gthread.py", line 323, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/werkzeug/local.py", line 237, in application
    return ClosingIterator(app(environ, start_response), self.cleanup)
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/werkzeug/wrappers/request.py", line 194, in application
    resp = f(*args[:-2] + (request,))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 84, in application
    response = handle_exception(e)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 338, in handle_exception
    response = get_response("message", http_status_code=http_status_code)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/serve.py", line 27, in get_response
    response = ErrorPage(exception=e).render()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/page_renderers/error_page.py", line 7, in __init__
    super().__init__(path=path, http_status_code=http_status_code)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/page_renderers/template_page.py", line 45, in __init__
    self.set_template_path()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/page_renderers/template_page.py", line 54, in set_template_path
    app_path = frappe.get_app_path(app)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1356, in get_app_path
    return get_pymodule_path(app_name, *joins)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1373, in get_pymodule_path
    return os.path.join(os.path.dirname(get_module(scrub(modulename)).__file__ or ""), *joins)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1327, in get_module
    return importlib.import_module(modulename)
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'payments'

Now I must admit I am from the PHP world and do not yet fully follow what I am doing wrong, or how to debug this more... but I am willing to try and fix this. Please just point me in the right direction. Thanks!

matt-campos commented 1 year ago

Any update? Have same issue

littletuna4 commented 2 months ago

I was getting this aswell, Got it mostly working, but (as you can see in the issues I've raised - I'm no expert myself)

If version-14 If version-15 note
bench get-app payments --branch version-14 --resolve-deps bench get-app payments --branch version-15 --resolve-deps
bench use <yoursitename>
bench --site <yoursitename> install-app payments bench install-app payments
bench migrate bench migrate
bench build bench build (not sure if this is necessary in either version, but good for good measure.)
exit exit all done with bench

The docker architecture is super confusing and unfortunately poorly documented for noobs like myself. But if I was to summarise how I understand that it works with respect to app installation:

TLDR:

Restart the frontend and backend containers