Closed vymao closed 7 months ago
I cannot help a lot, but
deps
. I hope this clue gets you on the right track.In the repo description, there is the following:
@pybind11//:pybind11_embed currently supports Python 3 MacOS/Ubuntu/Debian environments:
pyenv pipenv virtualenv
If pybind11_embed doesn't work with your embedded Python project, add @pybind11 as a dependency to your cc_binary and follow the instructions for manually retrieving the build flags.
Considering I use conda, could this be the issue? I'm not 100% sure how to resolve this using Conda though.
Considering I use conda, could this be the issue? I'm not 100% sure how to resolve this using Conda though.
Sorry, no idea.
I'd try to add to copts
, -L
and -lpthon3.12
or similar (maybe with -Wl,
). The main problem is to pint-point the correct Python runtime library.
Thanks. But I wonder: considering Bazel is able to compile/build without issue, is it strictly a linking issue? I think copts
will be for compilation, no?
We don't test embedding, at all, internally or externally (AFAIK, almost certain). I hope you can figure it out with the clues I can offer, or someone else can help.
As of the v2.11.1.bzl.2 release, pybind11_bazel uses rules_python and the pybind11_embed
target no longer exists. Please try using @rules_python//python/cc:current_py_cc_libs
instead; if that has any problems, please file a new issue (feel free to loop me in!) with the https://github.com/bazelbuild/rules_python project.
I'm trying to embed Python into a C++ application via Bazel. My WORKSPACE includes the following:
and my BUILD looks like
and my
main.cc
file uses#include <pybind11/embed.h>
andnamespace py = pybind11;
. But when I try and dopy::scoped_interpreter guard{};
, I getdyld[69334]: symbol not found in flat namespace '_PyBaseObject_Type'
. Not sure why this is? It compiles without issue. Could this be because I use Anaconda environments to manage Python dependencies?