Cheminformatics Tutorials - Herong's Tutorial Examples - v2.01, by Herong Yang
"Open Babel Error in LoadAllPlugins" Error
This section provides a tutorial example on how to resolve the 'Open Babel Error in LoadAllPlugins' error by adding the the BABEL_LIBDIR environment variable.
If you installed Open Babel from binary packages or source code files, you may see some errors when using Open Babel programs. Here is an example with Open Babel 3.1.1 on my CentOS system.
1. Check Open Babel installations.
herong$ dnf list installed | grep openbabel openbabel.x86_64 3.1.1-14.el8 @epel openbabel-libs.x86_64 3.1.1-14.el8 @epel herong$ /usr/bin/obabel -V Open Babel 3.1.1 -- Sep 27 2022 -- 18:26:52
2. Generate the molecule structure in SVG format from a SMILES string.
herong$ /usr/bin/obabel -:c1ccccc1 -O out.svg 1 molecule converted
3. Try to generate the molecule structure in SDF format from a SMILES string. I got an error.
herong$ /usr/bin/obabel -:c1ccccc1 -O out.sdf *** Open Babel Error in LoadAllPlugins Unable to find OpenBabel plugins. Try setting the BABEL_LIBDIR environment variable. Missing or unknown output file or format spec or possibly a misplaced option. Options, other than -i -o -O -m, must come after the input files. Open Babel 3.1.1 -- Sep 27 2022 -- 18:26:52 Usage: obabel [-i<input-type>] <infilename> [-o<output-type>] -O<outfilename> Try -H option for more information.
4. Try to get help on the SDF format. I got an error.
herong$ /usr/bin/obabel -H sdf ============================== *** Open Babel Error in LoadAllPlugins Unable to find OpenBabel plugins. Try setting the BABEL_LIBDIR environment variable. Format type: was not recognized
5. Read the "Install Open Babel" document at https://openbabel.org/docs/dev/_sources/Installation/install.txt again. It contains the following question and answer:
What environment variables affect how Open Babel finds formats, plugins and libraries? **LD_LIBRARY_PATH** - Used to find the :file:`libopenbabel.so` file. You should set this if you get error messages about not being able to find :file:`libopenbabel.so`. **BABEL_LIBDIR** - Used to find plugins such as the file formats If ``obabel -L formats`` does not list any file formats, then you need to set this environment variable to the directory where the file formats were installed, typically :file:`/usr/local/lib/openbabel/`. **BABEL_DATADIR** - Used to find data files for fingerprints, forcefields, If you get errors about not being able to find some .txt files, then you should set this to the name of the folder containing files such as :file:`patterns.txt` and :file:`MACCS.txt`. These are typically installed to :file:`/usr/local/share/openbabel`.
6. Locate the directory where file formats are installed.
herong$ rpm --query --list openbabel-libs /usr/lib/.build-id /usr/lib/.build-id/04 /usr/lib/.build-id/04/e9628013432e170e279512912c3f3c5cf50d58 /usr/lib/.build-id/0b /usr/lib/.build-id/0b/c9fad959fb351db3b8df25cb4a44a8b112582f ... /usr/lib64/libinchi.so.0 /usr/lib64/libinchi.so.0.4.1 /usr/lib64/libopenbabel.so.7.0.0 /usr/lib64/openbabel /usr/lib64/openbabel/APIInterface.so /usr/lib64/openbabel/CSRformat.so /usr/lib64/openbabel/MCDLformat.so /usr/lib64/openbabel/MNAformat.so /usr/lib64/openbabel/PQSformat.so ... /usr/lib64/openbabel/mdlformat.so /usr/lib64/openbabel/mmcifformat.so /usr/lib64/openbabel/mmodformat.so /usr/lib64/openbabel/mol2format.so ... /usr/lib64/openbabel/smilesformat.so /usr/lib64/openbabel/smileyformat.so /usr/lib64/openbabel/stlformat.so /usr/lib64/openbabel/svgformat.so ... /usr/share/doc/openbabel-libs /usr/share/doc/openbabel-libs/AUTHORS /usr/share/licenses/openbabel-libs/inchi-license-lgpl-2.1.txt /usr/share/openbabel /usr/share/openbabel/3.1.1 /usr/share/openbabel/3.1.1/MACCS.txt /usr/share/openbabel/3.1.1/SMARTS_InteLigand.txt /usr/share/openbabel/3.1.1/UFF.prm ... /usr/share/openbabel/3.1.1/svgformat.script /usr/share/openbabel/3.1.1/templates.sdf /usr/share/openbabel/3.1.1/torlib.txt /usr/share/openbabel/3.1.1/torsion.txt /usr/share/openbabel/3.1.1/types.txt
7. Add BABEL_LIBDIR environment variable and generate SDF files again.
herong$ export BABEL_LIBDIR="/usr/lib64/openbabel/" herong$ /usr/bin/obabel -:c1ccccc1 -O out.sdf --gen2D 1 molecule converted herong$ /usr/bin/obabel "-:c1cc(ccc1CC(C(=O)O)N)O" -O tyrosine.sdf --gen3D 1 molecule converted
As you can see, the "Open Babel Error in LoadAllPlugins" error is resolved now. If you see other errors, you may need to set all 3 environment variables LD_LIBRARY_PATH, BABEL_LIBDIR and BABEL_DATADIR.
If you want to make "obabel" command available at /usr/local/bin/obabel, you can create a shell script there.
herong$ sudo vi /usr/local/bin/obabel export BABEL_LIBDIR="/usr/share/openbabel/3.1.1" source /usr/bin/obabel $1 $2 $3 $4 $5 $6 $7 $8 herong$ sudo chmod 755 /usr/local/bin/obabel
Table of Contents
SMILES (Simplified Molecular-Input Line-Entry System)
►Open Babel: The Open Source Chemistry Toolbox
Install Open Babel with Anaconda
Install Open Babel on Windows Computers
Run Open Babel GUI on Windows Computers
Change Display Command on Open Babel GUI
Open Babel Installation Options on Linux
Install Open Babel Binary Package on CentOS
►"Open Babel Error in LoadAllPlugins" Error
Install Open Babel from Source Code
Install Open Babel 2.4.1 from Source Code
Open Babel Installation Options on macOS
Install Open Babel Binary Package on macOS
Using Open Babel Command: "obabel"
Generating SVG Pictures with Open Babel
Substructure Search with Open Babel
Similarity Search with Open Babel
Fingerprint Index for Fastsearch with Open Babel
Stereochemistry with Open Babel
Command Line Tools Provided by Open Babel
RDKit: Open-Source Cheminformatics Software
rdkit.Chem.rdchem - The Core Module
rdkit.Chem.rdmolfiles - Molecular File Module
rdkit.Chem.rdDepictor - Compute 2D Coordinates
rdkit.Chem.Draw - Handle Molecule Images
Molecule Substructure Search with RDKit
rdkit.Chem.rdmolops - Molecule Operations
Daylight Fingerprint Generator in RDKit
Morgan Fingerprint Generator in RDKit
RDKit Performance on Substructure Search
Introduction to Molecular Fingerprints
OCSR (Optical Chemical Structure Recognition)
AlphaFold - Protein Structure Prediction