App Cannot Import RDKit Draw Function

Hello,

I am deploying my app via streamlit cloud that works fine in my local. App includes visualization of a chemical compound, which is achieved via RDKit library’s Draw functions.

When I am trying to deploy my app, I am getting below message from “Manage App”

ImportError: libXrender.so.1: cannot open shared object file: No such file or directory

"ImportError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app)."

────────────────────────────────────────────────────────────────────────────────────────


[06:51:26] 🐍 Python dependencies were installed from /mount/src/colasso/requirements.txt using uv.

Check if streamlit is installed

Streamlit is already installed

[06:51:28] 📦 Processed dependencies!




────────────────────── Traceback (most recent call last) ───────────────────────

  /home/adminuser/venv/lib/python3.8/site-packages/streamlit/runtime/scriptrun  

  ner/script_runner.py:552 in _run_script                                       

                                                                                

  /mount/src/colasso/colasso_demo.py:11 in <module>                             

                                                                                

      8 import yaml                                                             

      9 from rdkit import rdBase                                                

     10 from rdkit.Chem import MolFromSmiles                                    

  ❱  11 from rdkit.Chem import Draw                                             

     12 from rdkit import Chem                                                  

     13 import random                                                           

     14 from torch import nn                                                    

                                                                                

  /home/adminuser/venv/lib/python3.8/site-packages/rdkit/Chem/Draw/__init__.py  

  :20 in <module>                                                               

                                                                                

      17                                                                        

      18 from rdkit import Chem, RDConfig, rdBase                               

      19 from rdkit.Chem import rdDepictor                                      

  ❱   20 from rdkit.Chem.Draw import rdMolDraw2D                                

      21 from rdkit.Chem.Draw.MolDrawing import DrawingOptions, MolDrawing      

      22 from rdkit.Chem.Draw.rdMolDraw2D import *                              

      23                                                                        

────────────────────────────────────────────────────────────────────────────────

ImportError: libXrender.so.1: cannot open shared object file: No such file or 

directory

And the application shows me the below message

ImportError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).
Traceback:
File "/home/adminuser/venv/lib/python3.8/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
    exec(code, module.__dict__)
File "/mount/src/colasso/colasso_demo.py", line 11, in <module>
    from rdkit.Chem import Draw
File "/home/adminuser/venv/lib/python3.8/site-packages/rdkit/Chem/Draw/__init__.py", line 20, in <module>
    from rdkit.Chem.Draw import rdMolDraw2D

How can I resolve this?

Thank you!

Apparently, the claim that

The wheels contain the compiled platform-specific dynamic libraries (*.so, *.dylib, and *.dll)

does not completely hold. Which makes sense for libraries commonly present in desktop systems.

Try installing libxrender1.

2 Likes

Thank you so much!! I did not know about packages.txt. That solved my problem.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.