Post Go back to editing

LIbiio and Pyadi-iio install error on Ubuntu 20.04

Category: Software

Hello,

I am trying to use Pyadi-iio package on the Ubuntu. I follow the instruction of this page: https://wiki.analog.com/resources/tools-software/linux-software/pyadi-iio.

1. build libiio from source

2. my python is 3.8

3. run "pip install pylibiio" and "pip install pyadi-iio" 

After that, when I run: python3 -c "import iio; print(iio.__file__); print(iio.version)", the result is:

pci@pci-virtual-machine:~$ python3 -c "import iio; print(iio.__file__); print(iio.version)"
Using Libiio v0.x -> v1.x compatibility layer
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/pci/.local/lib/python3.8/site-packages/iio.py", line 540, in <module>
    _c_read = _lib.iio_channel_read
  File "/usr/lib/python3.8/ctypes/__init__.py", line 386, in __getattr__
    func = self.__getitem__(name)
  File "/usr/lib/python3.8/ctypes/__init__.py", line 391, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /lib/x86_64-linux-gnu/libiio.so.0: undefined symbol: iio_channel_read

when I run: python3 -c "import adi; print(adi.__file__); print(adi.version)", the result is:

pci@pci-virtual-machine:~$ python3 -c "import adi; print(adi.__file__); print(adi.version)"Using Libiio v0.x -> v1.x compatibility layer
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/pci/.local/lib/python3.8/site-packages/adi/__init__.py", line 5, in <module>
    from adi.ad469x import ad469x
  File "/home/pci/.local/lib/python3.8/site-packages/adi/ad469x.py", line 10, in <module>
    from adi.context_manager import context_manager
  File "/home/pci/.local/lib/python3.8/site-packages/adi/context_manager.py", line 5, in <module>
    import iio
  File "/home/pci/.local/lib/python3.8/site-packages/iio.py", line 540, in <module>
    _c_read = _lib.iio_channel_read
  File "/usr/lib/python3.8/ctypes/__init__.py", line 386, in __getattr__
    func = self.__getitem__(name)
  File "/usr/lib/python3.8/ctypes/__init__.py", line 391, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /lib/x86_64-linux-gnu/libiio.so.0: undefined symbol: iio_channel_read

Could you give me some advice? Thanks!

Best,

Dongyu

  • Hi,


    1. build libiio from source

    Did you download the source code from the latest release (v0.25) or did you use the Git repository and the default "main" branch?
    It looks like you are using libiio v1 as a base library, while the Python bindings are built for v0.25.
    There is a major change going from v0.25 to libiio v1 so you might get these issues because of that.
    Please check the version by running the following command:

    iio_info -V

    If this command outputs the following: "iio_info version: 1.0", then you need to uninstall this libiio version. Then get the v0.25 source code, rebuild it and install it.
    If this command outputs v0.25, then we can investigate further.

    Thank you!
    -Alexandra

  • Hi Alexandra,

    You are right! After I install the v0.25 libiio, all the errors disappear! Thanks so much for your help!

    Best,

    Dongyu