pybind / pybind/pybind11_abseil
ImportError: generic_type: cannot initialize type "StatusCode": an object with that name is already defined
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 27
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I am trying to figure out some issues with using the pybind11_abseil.status usage. TensorFlow as well as some other Google projects are using the pybind11_abseil modules. I found that as of TensorFlow 2.14.0 (2.13.1 is fine), it looks like that using TensorFlow in conjunction with packages that use pybind11_abseil will fail with the error
ImportError: generic_type: cannot initialize type "StatusCode": an object with that name is already defined
This happens for example in https://github.com/google-deepmind/launchpad/issues/44 and https://github.com/tensorflow/tflite-support/issues/954. The error happens when a pybind11 extension that uses
py::google::ImportStatusModule() is called.
For example
import tensorflow
import launchpad # Fails when importing an extension that uses ImportStatusModule.
Reversing the order we will see the same issues this time coming from TensorFlow trying to import a module that uses
ImportStatusModule.
I noticed that there are some changes to the pybind11_abseil version used in TensorFlow 2.14.0, which incoporates some changes around the import_status_module, but I don't have a really good clue about what that change entails, it would be quite useful if you can provide some help.
Thanks!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the py::google::ImportStatusModule() entry point and reproduce the failure by importing TensorFlow and launchpad in both orders. Trace how the pybind11 extension initializes StatusCode; done means packages using ImportStatusModule can be imported together without the duplicate-type ImportError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, tensorflow
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100