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

Better error message when RDKit or OpenBabel are not installed #81

Merged
merged 3 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Contributors: @RMeli

* LGTM badge and code annotations [PR #76 | @RMeli]

### Added

* Error message when `spyrmsd` is used as module but neither OpenBabel nor RDKit are installed [PR #81 | @RMeli]

------------------------------------------------------------------------------

## Version 0.5.2
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ If you find `spyrmsd` useful, please consider citing the following paper:

_Note_: `spyrmsd` will install [NetworkX](https://networkx.github.io/) (multi-platform). You can install [graph-tool](https://graph-tool.skewed.de/) on macOS and Linux for higher performance.

_Note_: If `spyrmsd` is used as a standalone tool, it is required to install either [RDKit](https://rdkit.org/) or [Open Babel](http://openbabel.org/). Neither is automatically installed with `pip` nor `conda`.

### PyPI

```bash
Expand Down
10 changes: 10 additions & 0 deletions spyrmsd/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

if __name__ == "__main__":
import argparse as ap
import importlib.util

import sys

from spyrmsd import io
Expand All @@ -27,6 +29,14 @@

args = parser.parse_args()

if (
importlib.util.find_spec("openbabel") is None
and importlib.util.find_spec("rdkit") is None
):
raise ImportError(
"OpenBabel or RDKit not found. Please install OpenBabel or RDKit to use sPyRMSD as a standalone tool."
)

try:
ref = io.loadmol(args.reference)
except OSError:
Expand Down
Loading