Jasper_erpnext_report installation error

All

I am running latest erpnext and frappe code and trying to install the jasper_erpnext_report custom app.

These are the two commands I am using

bench get-app jasper_erpnext_report https://github.com/consoleerp/jasper_erpnext_report.git \
    2>&1 | tee --append jasper-reports-install.log
bench install-app jasper_erpnext_report 2>&1 | tee --append jasper-reports-install.log

During the install-app step, I am getting this error:

Installing jasper_erpnext_report...
CLASSPATH /home/erpnext/erpnext-dev/apps/jasper_erpnext_report/jasper_erpnext_report/java/lib/*:.:
pyjnius is installed: True
Updating DocTypes for jasper_erpnext_report: [========================================]
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/utils/bench_helper.py", line 94, in <module>
    main()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/commands/site.py", line 160, in install_app
    _install_app(app, verbose=context.verbose)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/installer.py", line 145, in install_app
    add_to_installed_apps(name)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/installer.py", line 166, in add_to_installed_apps
    post_install(rebuild_website)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/installer.py", line 230, in post_install
    init_singles()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/installer.py", line 248, in init_singles
    doc = frappe.new_doc(single)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/__init__.py", line 610, in new_doc
    return get_new_doc(doctype, parent_doc, parentfield, as_dict=as_dict)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/model/create_new.py", line 20, in get_new_doc
    frappe.local.new_doc_templates[doctype] = make_new_doc(doctype)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/model/create_new.py", line 38, in make_new_doc
    "docstatus": 0
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/__init__.py", line 634, in get_doc
    return frappe.model.document.get_doc(*args, **kwargs)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/model/document.py", line 66, in get_doc
    controller = get_controller(doctype)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/model/base_document.py", line 35, in get_controller
    module = load_doctype_module(doctype, module_name)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/modules/utils.py", line 178, in load_doctype_module
    raise ImportError('Module import failed for {0} ({1})'.format(doctype, module_name + ' Error: ' + str(e)))
ImportError: Module import failed for Student Batch Creation Tool (erpnext.schools.doctype.student_batch_creation_tool.student_batch_creation_tool Error: No module named student_batch_creation_tool.student_batch_creation_tool)

Why would the custom app worry about a module in the schools domain? That being said, I don’t see the tool listed in schools and when I search I get this error:

Traceback (most recent call last):
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/app.py", line 57, in application
    response = frappe.handler.handle()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/handler.py", line 22, in handle
    data = execute_cmd(cmd)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/handler.py", line 53, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/__init__.py", line 935, in call
    return fn(*args, **newargs)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/desk/form/load.py", line 71, in getdoctype
    docs = get_meta_bundle(doctype)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/desk/form/load.py", line 81, in get_meta_bundle
    bundle = [frappe.desk.form.meta.get_meta(doctype)]
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/desk/form/meta.py", line 22, in get_meta
    meta = frappe.cache().hget("form_meta", doctype, lambda: FormMeta(doctype))
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/utils/redis_wrapper.py", line 173, in hget
    value = generator()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/desk/form/meta.py", line 22, in <lambda>
    meta = frappe.cache().hget("form_meta", doctype, lambda: FormMeta(doctype))
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/desk/form/meta.py", line 34, in __init__
    self.load_assets()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/desk/form/meta.py", line 41, in load_assets
    self.add_code()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/desk/form/meta.py", line 87, in add_code
    self.add_html_templates(path)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/desk/form/meta.py", line 99, in add_html_templates
    for fname in os.listdir(path):
OSError: [Errno 2] No such file or directory: '/home/erpnext/erpnext-dev/apps/erpnext/erpnext/schools/doctype/student_batch_creation_tool'

I have this directory on my production system that has been around for over a year before student batches were merged in with student groups. So I have the directory on my prod box, but not on a brand new fresh install of erpnext on my dev box.

Thoughts?

Is your ERPNext instance up to date?

Yes. Running ERPNext 9.2.18 and Frappe 9.2.19

@fahimalizain - I see you were the last person to commit to the github repo. Do you have any insight on this error?

On my dev environment, I did a bench --force reinstall to bring the database to a clean slate and was able to get the software to install without error. However, when I try to update the JasperServerConfig document and save I get this error now:

You don't have local server. Install python module pyjnius first.

However, it was found during install

Installing jasper_erpnext_report...
CLASSPATH /home/erpnext/erpnext-dev/apps/jasper_erpnext_report/jasper_erpnext_report/java/lib/*:.:
pyjnius is installed: True

Still don’t know why I am getting the doctype error on my stage environment that has a copy of my prod database.

Hi
Its been long since I have used that repo. we moved away from it because of some limitations we faced that I dont remember. (Something to do with reports I think)

Anyway, for your issue;
pyjnius variable is False- which causes this exception to be thrown

The variable is modified only here I believe, as a startup check:

https://github.com/saguas/jasper_erpnext_report/blob/8c2ae4e756e4fcb46d63b591fe91bbd4f18a8515/jasper_erpnext_report/init.py#L10

So goto bench console and try importing pyjnius module ?
If that did not go fine, pyjnius is not installed properly i think.

good luck :slight_smile:

When pyjnius is installed, it is just jnius, however inside the jasper_erpnext_report app it is referenced as its full name.

From bench console I ran this:

In [1]: from jasper_erpnext_report import pyjnius

In [2]: pyjnius??
Type:        bool
String form: True

So here it thinks the boolean is true. I also ran this:

In [3]: import jasper_erpnext_report

In [4]: jasper_erpnext_report??
Type:        module
String form: <module 'jasper_erpnext_report' from '/home/erpnext/erpnext-dev/apps/jasper_erpnext_report/jasper_erpnext_report/__init__.pyc'>
File:        ~/erpnext-dev/apps/jasper_erpnext_report/jasper_erpnext_report/__init__.py
Source:
from __future__ import unicode_literals
import frappe
#import logging, os, sys

jasper_session_obj = frappe.local("jasper_session_obj")
jasper_session = frappe.local("jasper_session")
pyjnius = False

try:
        import jnius_config as jc
        pyjnius = True
except:
        pyjnius = False

So seeing this, the module right away tries to bring in the jnius_config and if successful sets the variable to True. I am able to do the same in the console without error. So not sure why inside the ServerRoot.py file it thinks it’s False.

You mention this

What did you move to? Trying to get a BI/Reporting tool integrated into the ERPNext UI and this is the only option I have seen. I am used to JasperReports as well as Eclipse BIRT. So either would be great for me. Anything you can provide would be fantastic.

Hm. Well, looking into the code, the author sets pyjnius = False on whatever config exception.
jasper_erpnext_report/jasper_reports/init.py

It will be a bit tricky to understand what went wrong :frowning:

We started using the default wkhtmltopdf library that erpnext is using. I did not know that we had a fine control over our prints until @maxtorete mentioned about it in a github issue I had raised.

https://github.com/frappe/frappe/issues/3490

Hope it helps :slight_smile:

Hi

I have same error.

 ImportError('Module import failed for {0} ({1})'.format(doctype, module_name + ' Error: ' + str(e)))
ImportError: Module import failed for Student Batch Creation Tool (erpnext.schools.doctype.student_batch_creation_tool.student_batch_creation_tool Error: No module named student_batch_creation_tool.student_batch_creation_tool)

And I try to check Education Domain to load Education code then install again app. Install App is ok. Then I disable Education.