-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add example for embedding python in a C++ application #92
Comments
Could someone help me at least get the plotting application up and running? |
Sorry I cannot help, except let you know that we've tragically lost our pybind11_bazel maintainer. I hope someone else will step up: Please contact me for admin permissions. |
I can give it a shot. Can you point me to any necessary build instructions beyond the basics (I'm familiar with rules_python's hermetic Python toolchain but less so with a hermetic C++ one). Is the issue the Python side with matplotlib? |
Ouch, that's tragic news indeed. I'm an Xoogler and current active pybind11_bazel user. I'm happy to pitch in with maintaining the project in whatever capacity I can. @junyer and I worked on a few small PRs for this repo in the past. |
@jiawen I just sent an invite for adding you with admin permissions. @rickeylev for awareness. |
@jiawen Thanks for the help. Yes there are two binaries in the BUILD.bazel. One ("embed") is from the examples provided in the other issue. You can ignore that one. The primary one I'm looking to get functional is "plot". I've had success with this using a local python repo and direct python calls, but I've had trouble reproducing that work with a hermetic python instance and pybind. The hermetic C++ toolchain works fine. The issue is currently in finding the associated libraries of the python toolchain (I think). I think the reason this worked with a local python instance is because it just used the local PATH variables to find the libraries needed (such as numpy). |
I'm so sorry to hear that. |
I have an example up and running. https://github.com/JBPennington/pybind_cpp_w_python_example The only current issue is that I can't create a cc_library with the python dependency because the current implementation requires setting env variables in the cc_binary or cc_test and cc_library doesn't support the env variable. It would be great to enforce that as a transitive property on the binary. I could instead set those as defines and set the env variables in the lib call. |
I've started an example repo for embedding python in a C++ program and I'd like add it to the examples here. I'm having trouble getting the two example files to work. The goal is to use a hermetic C++ toolchain and hermetic python toolchain to produce a plot with matplotlib. I've cobbled this together from the other Issue How to set python interpreter within cc_binary #77
The text was updated successfully, but these errors were encountered: