UWMRO/Instruments

Using PyBind11 to interface with Andor C++ code in Python

Closed this issue · 3 comments

Installing

First, I followed this excerpt from the documentation:

There are several ways to get the pybind11 source, which lives at pybind/pybind11 on GitHub. The pybind11 developers recommend one of the first three ways listed here, submodule, PyPI, or conda-forge, for obtaining pybind11.

Include with conda-forge

You can use pybind11 with conda packaging via conda-forge:

conda install -c conda-forge pybind11

From Slack:

Small Update: was able to get an example of pybind11 running! ...but then when I reopened the program to test it stopped working again 😕 here's the message I keep getting when running:

(uwmro_instruments) $ which python
/home/mattketk/anaconda3/envs/uwmro_instruments/bin/python
(uwmro_instruments) $ python
Python 3.10.0 (default, Dec 21 2021, 13:36:04) [GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import example
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /home/mattketk/anaconda3/envs/uwmro_instruments/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/mattketk/Development/pybind11/example.cpython-310-x86_64-linux-gnu.so)
>>>

The solution might be to copy the missing file or make a symlink to it, like this:

$ ln -sf /usr/lib/libstdc++.so.6 ~/anaconda3/envs/uwmro_instruments/lib/libstdc++.so.6

More permanent solution:
conda install -c conda-forge libstdcxx-ng