Code Monkey home page Code Monkey logo

Comments (4)

rvianello avatar rvianello commented on June 26, 2024

@adam-of-barot the problem sounds like could be related to a mismatching RDKit version (for example trying to unpickle a molecule with an older RDKit version), but I have the impression I am missing some information. Where did you update RDKit, in the django application environment, on the postgres server, or on both? And (sorry in case it should be obvious) with frontend and backend, what are you more exactly referring to, in this context? A more detailed description of the query you are performing I think would be also helpful to me.

from django-rdkit.

adam-of-barot avatar adam-of-barot commented on June 26, 2024

@rvianello I updated RDKit in the conda environment that the Django application uses. I did not upgrade anything related to the cartridge. Running the SQL command SELECT rdkit_version(); gives me 0.73.0.

By frontend I meant that I tried performing the searches through a browser with the web pages that I've built, and by backend I meant performing the searches through the command line with python manage.py shell.

Here is a query that just tried to run through the aforementioned shell as a test:

In [1]: from app.models import ReagentStructure

In [2]: r = ReagentStructure.objects.last()

In [3]: print(r.molecule, r.smiles)

Out[3]: <rdkit.Chem.rdchem.Mol object at 0x00000212855768B0> NNC(=O)OCc1ccccc1

In [4]: ReagentStructure.objects.filter(molecule=r.smiles)  # search for an already existing molecule

Out[4]: ---------------------------------------------------------------------------
DataException                             Traceback (most recent call last)
~\Miniconda3\envs\app\lib\site-packages\django\db\backends\utils.py in _execute(self, sql, params, *ignored_wrapper_args)
     83             else:
---> 84                 return self.cursor.execute(sql, params)
     85

DataException: problem generating molecule from blob data

I also attached the full traceback here: traceback.txt

from django-rdkit.

rvianello avatar rvianello commented on June 26, 2024

Thank you for the additional details. I browsed the rdkit repository for some information, and I think version 0.73.0 refers to the 2018.03 RDKit release, implying that the postgres database is running on a version of RDKit that is now quite older than the one available to the django application.
I think the problem is probably that, because django-rdkit sends the molecule argument in binary form, the database cartridge may be unable to deserialize the data sent by the application and reconstruct a molecule instance (this is what the "problem generating molecule from blob data" error message refers to).

from django-rdkit.

adam-of-barot avatar adam-of-barot commented on June 26, 2024

I did some testing on my home linux system to check things with the out-of-date and up-to-date versions.

I tried out a fresh conda environment installation of RDKit (v2021.09.03), django-rdkit (v0.3.1), and in another fresh conda environment installed rdkit-postgresql (v2021.09.02) and made the necessary database setups.
I also made a quick test Django model with a single MolField.

SELECT rdkit_version(); gives 0.76.0.
A quick query of TestModel.objects.filter(mol__hassubstruct='CCCCC') on an empty database gives a proper empty QuerySet.

I then made another environment, this time having rdkit-postgresql v2018.03.03. After setting up the database the same way, running the same query above gave the "problem generating molecule from blob data" error.

So yeah, the problem is definitely the out-of-date RDKit version on the database side.

Thank you for looking into it @rvianello !

from django-rdkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.