geomeTRIC
geomeTRIC copied to clipboard
[BUG] Logging configuration update causes issue in default case of no logging configured
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.
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']},
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 :)
Yes, we can definitely do that (Sorry for the late reply). I think the .ini file must be missing from the setup.py file filters. I have been thinking of releasing 0.9.8 as a minor release that cherry-picks a few features from the master branch. Stay tuned for that.
- Lee-Ping
On Fri, Apr 22, 2022 at 11:31 AM Colton Hicks @.***> wrote:
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 https://github.com/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 :)
— Reply to this email directly, view it on GitHub https://github.com/leeping/geomeTRIC/issues/130#issuecomment-1106761078, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK76GBSSZHSXJYHONFIFFDVGLWAPANCNFSM45IEE43Q . You are receiving this because you were mentioned.Message ID: @.***>
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 :)
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
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 :)