bipedal-locomotion-framework: Error when using the python bindings on the master branch of blf

I recently tried to use the most updated version of blf (master branch), encountering issues in the exploitation of the python bindings.

More specifically, if:

  • a new RL docker container is created
  • the missing dependencies for blf (i.e. spdlog, manif and ospq-eigen) are installed (spdlog via apt, devel branch for manif and master branch for ospq-eigen)
  • the master branch of blf is compiled and installed

Then a simple import bipedal_locomotion_framework within ipython returns:

terminate called after throwing an instance of 'pybind11::error_already_set'
  what():  SystemError: <built-in method __contains__ of dict object at 0x7fd340ab23c0> returned a result with an error set
Aborted (core dumped)

By using instead previous blf commits such as:

the exploitation of the python bindings does not create any issue.

I will try to understand exactly from which commit (and/or associated dependency installation) on such an error appears, so that It can be easier to solve.

cc @GiulioRomualdi @diegoferigo

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 15 (14 by maintainers)

Most upvoted comments

Remember to update the import statement so that when the backward-compatible import that @GiulioRomualdi kindly implemented will be removed, you don’t have to update your code.

If the problem is solved, go ahead and close the issue.

Yes, that error is solved. I will now try to update my scripts looking at the successfull tests for each module of the bindings. I will keep you updated here in case further issues appear.

After a few modifications inspired by the python tests and by the commit on restructuring the python bindings in submodules, I was able to successfully run my scripts in the updated environment.

To summarize, the errors described in this issue are solved by installing manifpy via pip install git+https://github.com/artivis/manif@devel. If you agree, we can close this issue.

So, is everything fine? I guess we are in the limbo waiting that the manif bindings of the devel branch will land a release, and then we can also make a new blf release and sync the superbuild.

I remember some problem with spdlogs on Bionic, but I’m not aware of details @GiulioRomualdi @traversaro

Yes, everything was kind of blocked by https://github.com/TartanLlama/optional/pull/45, but at least that one unblocked now.

So, is everything fine? I guess we are in the limbo waiting that the manif bindings of the devel branch will land a release, and then we can also make a new blf release and sync the superbuild.

Yes, that error is solved. I will now try to update my scripts looking at the successfull tests for each module of the bindings. I will keep you updated here in case further issues appear.

Before I execed in the wrong container without noticing (too many open in the same time xD). I followed pretty much the same steps and I reproduced the original error. It’s very likely related to an old pybind11 version shipped in Ubuntu Focal. In the previous comment I used the version gathered by pip that is the most updated (however you have to point CMake to the right folder).

Installing manif as commented above solves the import error.

TL;DR, I don’t think we need to do much from the blf side. The cryptic error occurs only with outdated pybind11 versions (sadly, also that shipped in Focal). I’m not sure if we can find a better workaround @GiulioRomualdi.

The expected behavior is that, after you import bipedal_locomotion_framework, a Python exception get raised instead of a C++ exception. I would expect an ImportError.

I’d leave this issue open, we have to figure out what’s missing in our side to bind the C++ exception to the Python exception during the early stage of import.

A good candidate for checking when this problem started to occur is https://github.com/dic-iit/bipedal-locomotion-framework/pull/238, on a similar setup I’m still using the commit tagged by the superbuild that does not yet include the changes of that PR.

Maybe related to the usage of py::module::import? See https://github.com/pybind/pybind11/issues/686. Can you check if you have the manifpy module in your system?