no module error: python calling cpp using pybind

35 views
Skip to first unread message

Anupam Neogi

unread,
Feb 9, 2023, 9:41:07 AM2/9/23
to PyInstaller
Hi there,

I have a python package with multiple python routines and two of them are calling a cpp routine which is hooked using pybind11. Below is my directory view:

src
     |---a.py
     |---b.py  (importing routine.cpp as kbase)
     |--- c.py (importing routine.cpp as kbase)
     |--- api.py
     |--- routine.cpp

This routine.cpp is depending on the open CPP Eigen library. I have a local folder outside of /src named as lib which contain the Eigen library.
/lib/eigen_cpp

Now, I'm using pyinstaller to make a single executable of my api.py as api.exe. I'm using this commands,

pyinstaller --hidden-file=routine.cpp --onefile api.py

It creates the api.exe, but when I run it through terminal it says: "No module named 'generator.base'". This generator.base is actually the cpp routine named base though pybind11.


How to resolve this dependency? Thanks in advance.     




Reply all
Reply to author
Forward
0 new messages