I'm using pybind11 to create a Python wrapper for a small C++ class.
I'm getting the following error when importing the DLL (running python -v
to show Traceback):
>>> from a_py import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 657, in _load_unlocked
File "<frozen importlib._bootstrap>", line 556, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 1101, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed while importing a_py: The specified module could not be found.
The class has just two members - types from the PCL library:
class A
{
pcl::NormalEstimation< pcl::PointXYZ, pcl::Normal> normalEstimation_;
pcl::PointCloud<pcl::Normal>::Ptr normals_;
};
If I remove the first member I can successfully import the module from the DLL.
This is the pybind11 code:
namespace py = pybind11;
PYBIND11_MODULE(a_py, m)
{
py::class_<A>(m, "A");
}
PCL is found using CMake: find_package(PCL REQUIRED)
This happens on both Windows and Linux with the latest PCL (1.10) and older versions too.
(Adding #define PCL_NO_PRECOMPILE
before the #includes does not help.)
Update: I opened a GitHUb issue about this, since this seems like a spurious internal runtime dependency.