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

[BUG] Logging configuration update causes issue in default case of no logging configured #130

Closed
coltonbh opened this issue May 21, 2021 · 6 comments

Comments

@coltonbh
Copy link
Contributor

The first few lines of run_json.geometric_run_json update logging.config.fileConfig; however, if no configuration is set, i.e., no formatters are already configured, this code raises an exception. Using qcengine to execute a basic optimization results in the following:

FailedOperation(error=ComputeError(error_type='unknown_error', error_message='QCEngine Execution Error:\nTraceback (most recent call last):\n  File "/opt/conda/lib/python3.7/site-packages/qcengine/util.py", line 114, in compute_wrapper\n    yield metadata\n  File "/opt/conda/lib/python3.7/site-packages/qcengine/compute.py", line 147, in compute_procedure\n    output_data = executor.compute(input_data, config)\n  File "/opt/conda/lib/python3.7/site-packages/qcengine/procedures/geometric.py", line 44, in compute\n    output_data = geometric.run_json.geometric_run_json(input_data)\n  File "/opt/conda/lib/python3.7/site-packages/geometric/run_json.py", line 159, in geometric_run_json\n    logging.config.fileConfig(logIni,disable_existing_loggers=False)\n  File "/opt/conda/lib/python3.7/logging/config.py", line 71, in fileConfig\n    formatters = _create_formatters(cp)\n  File "/opt/conda/lib/python3.7/logging/config.py", line 104, in _create_formatters\n    flist = cp["formatters"]["keys"]\n  File "/opt/conda/lib/python3.7/configparser.py", line 958, in __getitem__\n    raise KeyError(key)\nKeyError: \'formatters\'\n'))

Essentially, the code in geomeTRIC is assuming the presence of logging formatters that may not exist.

@bennybp
Copy link
Contributor

bennybp commented Jan 7, 2022

Just ran into this. For me, this only happens with the version installed via pip. The package on PyPI seems to be missing the ini files

They are included in the conda package

EDIT: The setup.py file should be changed: package_data={'': ['config/*.ini']},

@coltonbh
Copy link
Contributor Author

Yes. This issue appears to be not with the code, per se, but with the version published to pypi.org. That version lacks the config directory so the logger initialization fails. @leeping would it be possible to publish a new version to pypi that contains the config dir? Would be nice to have a pip instalable version without having to install from source :)

@leeping
Copy link
Owner

leeping commented Jun 26, 2022 via email

@coltonbh
Copy link
Contributor Author

Fantastic! That would be great. I've been maintaining my own geometric version that adds a few of these fixes and it would be great to have the official published version include them :)

@leeping
Copy link
Owner

leeping commented Dec 14, 2022

The latest version of geomeTRIC on PyPI has the .ini files available, so it should work for you now. I'll close the issue but please reopen it if you're still having issues. Thanks!

  • Lee-Ping
$ tar xvzf geometric-1.0.tar.gz &> /dev/null
$ find . -name \*.ini
./geometric/config/log.ini
./geometric/config/logConsole.ini
./geometric/config/logJson.ini

@leeping leeping closed this as completed Dec 14, 2022
@coltonbh
Copy link
Contributor Author

Fantastic! I'd love to be able to build a few of my projects from PyPi instead of my patched versions on GitHub (makes distribution way easier). I'll get to my rebuilds over the coming weeks and ping you back if there are issues :)

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

Successfully merging a pull request may close this issue.

3 participants