Linux LIBIIO python bindings

Hey all, I am a bit stuck on getting my system operational.

OS: Ubuntu 18.04 in a VM, host system is Windows 10

LIBIIO: compiled using the cmake build described by AD in https://wiki.analog.com/resources/eval/user-guides/ad-fmcdaq2-ebz/software/linux/applications/libiio

The pluto is recognized and I can interact with it / SSH is fine

PYADI: installed in python 3 using pip

When trying to import the adi package in python3 I get the following error message. I read some things that it may be caused by the incorrect installation of the python bindings but I'm puzzled on how to proceed.

Who can help?

Thanks

>>> import adi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/usr/local/lib/python3.6/dist-packages/pyadi_iio-0.0.5-py3.6.egg/adi/__init__.py", line 34, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/usr/local/lib/python3.6/dist-packages/pyadi_iio-0.0.5-py3.6.egg/adi/ad9361.py", line 34, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/usr/local/lib/python3.6/dist-packages/pyadi_iio-0.0.5-py3.6.egg/adi/context_manager.py", line 34, in <module>
File "/home/bert/temp/libiio/bindings/python/iio.py", line 71, in <module>
_get_backends_count = _lib.iio_get_backends_count
File "/usr/lib/python3.6/ctypes/__init__.py", line 361, in __getattr__
func = self.__getitem__(name)
File "/usr/lib/python3.6/ctypes/__init__.py", line 366, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: python3: undefined symbol: iio_get_backends_count

  • 0
    •  Analog Employees 
    on Dec 6, 2019 4:04 PM 11 months ago

    It appears as the libiio bindings are installed but not the actual library itself.

    Can you run `iio_info -s` from the same directory you are running `import adi` from?

    -Travis

  • Hi Travis, thank you for the fast reply

    the command gives me

    Library version: 0.18 (git tag: 1036e51)
    Compiled with backends: local xml ip usb serial
    Available contexts:
        0: 0456:b673 (Analog Devices Inc. PlutoSDR (ADALM-PLUTO)), serial=104473ce6991000706000d007e2789c931 [usb:1.4.5]

    Additional information: The previous python error shows when running from the /libiio/bindings/python/ directory. When running it from somewhere else the error message is different:

    Python 3.6.9 (default, Nov  7 2019, 10:44:02)
    [GCC 8.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import adi
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python3.6/dist-packages/pyadi_iio-0.0.5-py3.6.egg/adi/__init__.py", line 34, in <module>
      File "/usr/local/lib/python3.6/dist-packages/pyadi_iio-0.0.5-py3.6.egg/adi/ad9361.py", line 34, in <module>
      File "/usr/local/lib/python3.6/dist-packages/pyadi_iio-0.0.5-py3.6.egg/adi/context_manager.py", line 34, in <module>
    ModuleNotFoundError: No module named 'iio'

  • 0
    •  Analog Employees 
    on Dec 6, 2019 4:22 PM 11 months ago in reply to radiohead

    That means that the bindings are not on path.

    I would recommend installing libiio to the standard location (not custom prefix), which is usually /usr/lib, and making sure the bindings are on path.

    There is a note about this in the doc: analogdevicesinc.github.io/.../quick.html

    -Travis

  • Which is exactly whay I did. I cloned the pyadi-iio github project, and installed the package using

    python3 setup.py install.

    Here are the last lines from the process. It installed just fine?

    removing 'build/bdist.linux-x86_64/egg' (and everything under it)
    Processing pyadi_iio-0.0.5-py3.6.egg
    Removing /usr/local/lib/python3.6/dist-packages/pyadi_iio-0.0.5-py3.6.egg
    Copying pyadi_iio-0.0.5-py3.6.egg to /usr/local/lib/python3.6/dist-packages
    pyadi-iio 0.0.5 is already the active version in easy-install.pth

    Installed /usr/local/lib/python3.6/dist-packages/pyadi_iio-0.0.5-py3.6.egg
    Processing dependencies for pyadi-iio==0.0.5
    Searching for numpy==1.18.0rc1
    Best match: numpy 1.18.0rc1
    Processing numpy-1.18.0rc1-py3.6-linux-x86_64.egg
    numpy 1.18.0rc1 is already the active version in easy-install.pth

  • 0
    •  Analog Employees 
    on Dec 6, 2019 5:59 PM 11 months ago in reply to radiohead

    That is pyadi-iio, not libiio. It looks like libiio is just in the directory "/home/bert/temp/libiio/" and not installed into a system path.

    -Travis