Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SystemError: initialization of _parser raised unreported exception #77

Open
daniiomir opened this issue Nov 30, 2021 · 2 comments
Open

Comments

@daniiomir
Copy link

This error appears randomly. Seems like it's memory leaks.

31mERR[39m   Averaged perceptron model could not be loaded

  [90m at address_parser_load (address_parser.c:205) [94merrno: Bad address[39m

[31mERR[39m   Error loading address parser module, dir=(null)

  [90m at libpostal_setup_parser_datadir (libpostal.c:434) [94merrno: Bad address[39m

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/usr/local/lib/python3.8/multiprocessing/spawn.py", line 116, in spawn_main

    exitcode = _main(fd, parent_sentinel)

  File "/usr/local/lib/python3.8/multiprocessing/spawn.py", line 125, in _main

    prepare(preparation_data)

  File "/usr/local/lib/python3.8/multiprocessing/spawn.py", line 236, in prepare

    _fixup_main_from_path(data['init_main_from_path'])

  File "/usr/local/lib/python3.8/multiprocessing/spawn.py", line 287, in _fixup_main_from_path

    main_content = runpy.run_path(main_path,

  File "/usr/local/lib/python3.8/runpy.py", line 265, in run_path

    return _run_module_code(code, init_globals, run_name,

  File "/usr/local/lib/python3.8/runpy.py", line 97, in _run_module_code

    _run_code(code, mod_globals, init_globals,

  File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code

    exec(code, run_globals)

  File "/app/app.py", line 13, in <module>

    model = RuleBasedProfiler(debug=CNFG['profiler']['debug'],

  File "/app/src/profilers/rule_based_profiler.py", line 29, in __init__

    self.attr_classes = dynamic_import(rules_path,

  File "/app/src/utils/dynamic_import.py", line 13, in dynamic_import

    module = importlib.import_module(''.join(['src.rules.', file_path.split(sep='/')[-2], '.', module_name]),

  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import

  File "<frozen importlib._bootstrap>", line 991, in _find_and_load

  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked

  File "<frozen importlib._bootstrap_external>", line 843, in exec_module

  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

  File "/app/src/rules/composite/address.py", line 3, in <module>

    from postal.parser import parse_address

  File "/usr/local/lib/python3.8/site-packages/postal/parser.py", line 2, in <module>

    from postal import _parser

SystemError: initialization of _parser raised unreported exception

[31mERR[39m   Averaged perceptron model could not be loaded

  [90m at address_parser_load (address_parser.c:205) [94merrno: Bad address[39m

[31mERR[39m   Error loading address parser module, dir=(null)

  [90m at libpostal_setup_parser_datadir (libpostal.c:434) [94merrno: Bad address[39m

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/usr/local/lib/python3.8/multiprocessing/spawn.py", line 116, in spawn_main

    exitcode = _main(fd, parent_sentinel)

  File "/usr/local/lib/python3.8/multiprocessing/spawn.py", line 125, in _main

    prepare(preparation_data)

  File "/usr/local/lib/python3.8/multiprocessing/spawn.py", line 236, in prepare

    _fixup_main_from_path(data['init_main_from_path'])

  File "/usr/local/lib/python3.8/multiprocessing/spawn.py", line 287, in _fixup_main_from_path

    main_content = runpy.run_path(main_path,

  File "/usr/local/lib/python3.8/runpy.py", line 265, in run_path

    return _run_module_code(code, init_globals, run_name,

  File "/usr/local/lib/python3.8/runpy.py", line 97, in _run_module_code

    _run_code(code, mod_globals, init_globals,

  File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code

    exec(code, run_globals)

  File "/app/app.py", line 13, in <module>

    model = RuleBasedProfiler(debug=CNFG['profiler']['debug'],

  File "/app/src/profilers/rule_based_profiler.py", line 29, in __init__

    self.attr_classes = dynamic_import(rules_path,

  File "/app/src/utils/dynamic_import.py", line 13, in dynamic_import

    module = importlib.import_module(''.join(['src.rules.', file_path.split(sep='/')[-2], '.', module_name]),

  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import

  File "<frozen importlib._bootstrap>", line 991, in _find_and_load

  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked

  File "<frozen importlib._bootstrap_external>", line 843, in exec_module

  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

  File "/app/src/rules/composite/address.py", line 3, in <module>

    from postal.parser import parse_address

  File "/usr/local/lib/python3.8/site-packages/postal/parser.py", line 2, in <module>

    from postal import _parser

SystemError: initialization of _parser raised unreported exception

[31mERR[39m   Averaged perceptron model could not be loaded

  [90m at address_parser_load (address_parser.c:205) [94merrno: Bad address[39m

[31mERR[39m   Error loading address parser module, dir=(null)

  [90m at libpostal_setup_parser_datadir (libpostal.c:434) [94merrno: Bad address[39m

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/usr/local/lib/python3.8/multiprocessing/spawn.py", line 116, in spawn_main

    exitcode = _main(fd, parent_sentinel)

  File "/usr/local/lib/python3.8/multiprocessing/spawn.py", line 125, in _main

    prepare(preparation_data)

  File "/usr/local/lib/python3.8/multiprocessing/spawn.py", line 236, in prepare

    _fixup_main_from_path(data['init_main_from_path'])

  File "/usr/local/lib/python3.8/multiprocessing/spawn.py", line 287, in _fixup_main_from_path

    main_content = runpy.run_path(main_path,

  File "/usr/local/lib/python3.8/runpy.py", line 265, in run_path

    return _run_module_code(code, init_globals, run_name,

  File "/usr/local/lib/python3.8/runpy.py", line 97, in _run_module_code

    _run_code(code, mod_globals, init_globals,

  File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code

    exec(code, run_globals)

  File "/app/app.py", line 13, in <module>

    model = RuleBasedProfiler(debug=CNFG['profiler']['debug'],

  File "/app/src/profilers/rule_based_profiler.py", line 29, in __init__

    self.attr_classes = dynamic_import(rules_path,

  File "/app/src/utils/dynamic_import.py", line 13, in dynamic_import

    module = importlib.import_module(''.join(['src.rules.', file_path.split(sep='/')[-2], '.', module_name]),

  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import

  File "<frozen importlib._bootstrap>", line 991, in _find_and_load

  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked

  File "<frozen importlib._bootstrap_external>", line 843, in exec_module

  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

  File "/app/src/rules/composite/address.py", line 3, in <module>

    from postal.parser import parse_address

  File "/usr/local/lib/python3.8/site-packages/postal/parser.py", line 2, in <module>

    from postal import _parser

SystemError: initialization of _parser raised unreported exception
@jenny2202
Copy link

Hi daniiomir, have you found a resolution for this error? I encountered the same

@jenny2202
Copy link

I found it, you should run your python code on the libpostal location folder then it will work,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants