1

I started to use rdkit and try to implement in Django with postgres. So I installed rdkit in my django virtualenv with pip install rdkit-pypi and also installed django-rdkit(https://github.com/rdkit/django-rdkit). This command: python3 -c "from rdkit import Chem; print(Chem.MolToMolBlock(Chem.MolFromSmiles('C1CCC1')))" works fine to me. But when I run migrate, it failed. The error is :

django.db.utils.OperationalError: could not open extension control file "/usr/share/postgresql/12/extension/rdkit.control": No such file or directory

It seems failed to create cartridge rdkit with postgres. Anyone can help me find the problem and solution (better not with Conda, cause I never use it before)? Thank you very much!

Joanna
  • 81
  • 1
  • 6
  • I guess I have to move to Conda… – Joanna Sep 02 '22 at 10:04
  • 1
    rdkit as a python package and rdkit as a PostgreSQL extension are different things. (Although the latter might include the former, I don't know). You have to make sure you installed the PostgreSQL-specific part of the software. – jjanes Sep 02 '22 at 14:05
  • Thanks jjanes. But I don't know how to add extension to postgres in pip way. So at this moment, I just solve the problem with conda installed rdkit-postgresql and rdkit-pypi. I kept postgresql running under conda env and my django running under pipenv...And django-rdkit can provide special mol field... fingers crossed... – Joanna Sep 03 '22 at 07:32

1 Answers1

0

OK I will answer by myself and close this question since the project is running well. I have to use conda and used conda-forge to create an rdkit extension for postgres can solve this problem. To create Rdkit-postgres cartridge just run:

    conda create -n environment
    (environment) $ conda activate rdkit-postgres
    (environment) $ conda install -c conda-forge postgresql
    (environment) $ conda install -c rdkit rdkit-postgresql

To create django with rdkit need install django-rdkit(https://github.com/rdkit/django-rdkit).

need to mention a bit difference is that I created the extension in database manually not by django-rdkit automatically due to some permission denied in case someone comes across the same situation.

Joanna
  • 81
  • 1
  • 6