All,
I've been trying to build a very simple openbabel example script but pyinstaller fails to set environment variables or include plugin data causing an error at runtime.
.\dist\obopt.exe
==============================
*** Open Babel Error in OpenBabel::OBPlugin::LoadAllPlugins
Unable to find OpenBabel plugins. Try setting the BABEL_LIBDIR environment variable.
==============================
*** Open Babel Error in OpenBabel::OBPlugin::LoadAllPlugins
Unable to find OpenBabel plugins. Try setting the BABEL_LIBDIR environment variable.
This is the script I am trying to build:
from openbabel import openbabel
class ob:
def read_xyz(file):
obconversion = openbabel.OBConversion()
obconversion.SetInAndOutFormats("xyz", "xyz")
mol = openbabel.OBMol()
obconversion.ReadFile(mol, file)
return mol
def write_xyz(mol,file):
obff=openbabel.OBForceField.FindForceField("Ghemical")
obff.Setup(mol)
obff.ConjugateGradients(10000)
obff.GetCoordinates(mol)
obconversion = openbabel.OBConversion()
obconversion.SetInAndOutFormats("xyz", "xyz")
obconversion.WriteFile(mol, file)
mol = ob.read_xyz('test.xyz')
I think this adds a new runtime hook in C:\Users\RO\Miniconda3\envs\ncapB\lib\site-packages\PyInstaller\hooks\rthooks\
I've also tried to supply the hook at build time with: pyinstaller --onefile --runtime-hook=obrth.py .\obopt.py
So far things are still not working. Build works on linux only windows is broken. I am running pyinstaller 5.7.0, python 3.10.8, openbabel 3.1.0. All installed with miniconda.
Any help would be appreciated.
Thanks,
Richard