pybind11 Questions

6

I am trying to follow the simple example for embedding python within c++ using pybind11 as found on this page. However, when trying to use cmake to build the solution, I keep getting an error that ...
Flyblow asked 4/8, 2020 at 20:26

2

Solved

Problem Statement I want to run and debug my own C++ extensions for python in "hybrid mode" in VSCode. Since defining your own python wrappers can be quite tedious, I want to use pybind11...
Skyler asked 15/2, 2022 at 10:48

2

I am trying to wrap up a c++ function that takes in Eigen::Quaternion as the argument for python usage. The function is defined as something like: void func(const Eigen::Quaternion<double> &a...
Swaim asked 9/2, 2021 at 20:45

2

I have installed pybind11 (several different ways, including pip and the package manager) on my Ubuntu 18.04.3 machine, but when I try to specify include files the recommended way: python3 -m pybi...
Dim asked 15/4, 2020 at 18:13

4

Solved

I see form my project document that I need to install python-pybind11 by using sudo apt -y install python-pybind11 but I got error like this: Reading package lists... Done Building dependency tre...
Thadeus asked 15/2, 2019 at 7:38

3

Solved

I have a C++ class with Python bindings using pybind11. Now I want to mark the binding of one method as deprecated. Let's assume it looks something like this: PYBIND11_MODULE(my_module, m) { pyb...
Magee asked 19/6, 2020 at 7:10

3

Solved

I have a C++ function computing a large tensor which I would like to return to Python as a NumPy array via pybind11. From the documentation of pybind11, it seems like using STL unique_ptr is desi...
Nay asked 20/6, 2017 at 17:52

4

We have a codebase in python which uses asyncio, and co-routines (async methods and awaits), what I'd like to do is to call one of these method from a C++ class which has been pulled into python (u...
Mitchmitchael asked 6/2, 2019 at 12:40

3

Solved

Firstly, my thanks to all of you for trying to resolve this doubt of mine. I am working on converting a minimal C++ project to be used in Python. The real reason behind this effort is for speed. I ...
Slosh asked 24/9, 2017 at 9:51

2

I've created a python binding for one of my projects a while back and just now wanted to pick it up again. The binding was no longer working as python was no longer able to import it - this all was...
Bedwell asked 11/11, 2019 at 4:47

2

Solved

EDIT: It works now, I do not know why. Don't think I changed anything I want to pass in and modify a large numpy array with pybind11. Because it's large I want to avoid copying it and returning a n...
Vendue asked 20/2, 2019 at 19:3

1

I am using the first step example in pybind11's documentation #include <pybind11/pybind11.h> int add(int i, int j) { return i + j; } PYBIND11_MODULE(example, m) { m.doc() = "pybind11 e...
Martlet asked 19/9, 2020 at 18:52

0

I am developing a python package with a C++ extension module that interops with the python code via pybind11, and which I am building using CMake (based on this answer). I have the package installe...
Follower asked 26/9, 2022 at 2:48

1

TL;DR Using pybind11, how can I expose an array of POD struct with NumPy, while also having them appear to the user as nice Python objects? The problem I am exposing a C style API to Python using p...
Paugh asked 30/8, 2022 at 14:46

2

Solved

typedef bool (*ftype_callback)(ClientInterface* client, const Member* member ,int member_num); struct Member{ char x[64]; int y; }; class ClientInterface { public: virtual int calc()=0; virt...
Eudora asked 6/1, 2022 at 7:37

1

Solved

The question Is pybind11 somehow magically doing the work of PyGILState_Ensure() and PyGILState_Release()? And if not, how should I do it? More details There are many questions regarding passing a ...
Keelykeen asked 5/7, 2022 at 22:23

1

Solved

pybind11 has the following method in numpy.h: /// Return dtype associated with a C++ type. template <typename T> static dtype of() { return detail::npy_format_descriptor<typename std::...
Craniotomy asked 27/6, 2022 at 14:46

1

Solved

I am starting out with pybind11, trying to compile the first example. I am using Xubuntu 20.04. My system python is 3.8, but I have install pybind11 only for python 3.10, which is the version that ...
Ethel asked 4/6, 2022 at 18:48

4

Solved

I'm trying to figure out how it is possible to receive an OpenCV image from a Python in C++. I'm trying to send a callback function, from C++ to my Python module, and then when I call a specific py...
Turk asked 29/3, 2020 at 17:6

2

Solved

I'm trying to generate python bindings for a dummy class which needs to be compiled with a cuda enabled compiler. I'm using cmake 3.12.0, pybind11 v2.2.3 and nvcc 7.5.17. Compilation fails because ...
Remaremain asked 18/8, 2018 at 10:46

2

Solved

I have a simple structure like: struct Config { bool option1; bool option2; int arg1; }; Using pybind11, I have to export the member variables like: py::class_<Config>(m, "Config&quo...
Escritoire asked 29/11, 2021 at 7:15

1

Solved

I have a large C++ library that I'm trying to expose using pybind11. I'm having trouble setting the include path correctly. The project directories are structured as follows: root - sub-project-1...
Marrero asked 26/8, 2019 at 3:17

1

Solved

I'm having trouble understanding how to use pybind11 conan package. I can use some others, but pybind11 is giving me hard time. My starting point is as follows: conanfile.txt: [requires] pybind11/2...
Sometime asked 30/10, 2021 at 20:31

1

Consider this little pybind11 wrapper + test: setup.py from pybind11.setup_helpers import Pybind11Extension from pybind11.setup_helpers import build_ext from setuptools import setup setup( name=&...
Imprudent asked 8/5, 2021 at 16:4

3

Solved

I am trying to call a python function from a C++ code which contains main() function using Pybind11. But I found very few references are available. Most of existing documents talk about the reverse...
Fourierism asked 1/3, 2017 at 1:51

© 2022 - 2024 — McMap. All rights reserved.