-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImportError for newer pybind11 versions #36
Comments
Yes that's why I restricted the version number here: https://github.com/block-hczhai/block2-preview/blob/master/setup.py#L170 |
Hi, I think this is a bug introduced in #include <pybind11/numpy.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl_bind.h>
#include <map>
#include <string>
namespace py = pybind11;
using namespace std;
PYBIND11_MODULE(xtest, m) {
m.doc() = "xtest.";
py::bind_map<map<int, int>>(m, "xx");
py::bind_map<map<long long int, int>>(m, "yy");
} Save this file as g++ -O3 -Wall -shared -std=c++11 -fPIC $(python3 -m pybind11 --includes) xtest.cpp -o xtest$(python3-config --extension-suffix) And then if you do ImportError: generic_type: cannot initialize type "KeysView[int]": an object with that name is already defined Now if you change the two lines to py::bind_map<map<int, double>>(m, "xx");
py::bind_map<map<long long int, int>>(m, "yy"); You get even strange warnings at compile time. So there is nothing I can do to fix this. Let's just give up the version |
This is basically pybind/pybind11#4529 |
Thanks for checking this. Hopefully they will resolve it soon. |
Have you found a workaround for this? |
@Tobias-Fischer @h-larsson The issue was fixed in pybind/pybind11#4985. |
Hi Huanchen,
It looks like Pybind Version >= 2.10.2 introduces the error
Which seems to be due to pybind/pybind11#4353
Do you have an idea how to fix this?
The text was updated successfully, but these errors were encountered: