Skip to content

Commit

Permalink
conda-forge
Browse files Browse the repository at this point in the history
  • Loading branch information
skearnes committed Apr 12, 2024
1 parent 08085e4 commit 14b063b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: |
# NOTE(skearnes): conda is only used for postgres (not python).
# NOTE(skearnes): rdkit-postgresql may not be available for ARM.
conda install -c rdkit rdkit-postgresql==2020.03.3.0 || conda install postgresql==12.2
conda install -c rdkit rdkit-postgresql==2020.03.3.0 || conda install -c conda-forge postgresql
initdb
- uses: actions/setup-python@v4
with:
Expand Down
8 changes: 4 additions & 4 deletions ord_schema/orm/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from sqlalchemy import cast, delete, func, select, text, update
from sqlalchemy.dialects.postgresql import insert
from sqlalchemy.engine import Engine
from sqlalchemy.exc import OperationalError
from sqlalchemy.exc import OperationalError, NotSupportedError
from sqlalchemy.orm import Session

from ord_schema.logging import get_logger
Expand Down Expand Up @@ -59,12 +59,12 @@ def prepare_database(engine: Engine) -> bool:
with engine.begin() as connection:
# NOTE(skearnes): The RDKit PostgreSQL extension works best in the public schema.
connection.execute(text("CREATE EXTENSION IF NOT EXISTS rdkit"))
rdkit_cartridge = True
except OperationalError:
rdkit_cartridge = True
except (OperationalError, NotSupportedError):
with engine.begin() as connection:
logger.warning("RDKit PostgreSQL cartridge is not installed; structure search will be disabled")
connection.execute(text("CREATE EXTENSION IF NOT EXISTS btree_gist"))
rdkit_cartridge = False
rdkit_cartridge = False
with patch.dict(os.environ, {"ORD_POSTGRES_RDKIT": "1" if rdkit_cartridge else "0"}):
Base.metadata.create_all(engine)
return rdkit_cartridge
Expand Down

0 comments on commit 14b063b

Please sign in to comment.