yoctopuce / yoctolib_python

Official Yoctopuce Library for Python
https://www.yoctopuce.com/EN/article/how-to-start-in-python-with-yoctopuce-modulesp
20 stars 12 forks source link

Release 59348 and above not fully backward compatible (GLibC) #9

Closed YoannVarquet closed 5 months ago

YoannVarquet commented 9 months ago

Hi,

I installed an older version through pip3 a one of my system, and it works great, (awesome job!), however, since New API, 2.0, the DLL are not compatible with my system. I use Nvidia with an old JetPack and can't move from it, and I get an GlibC imcompatibility issue. Having a lot of things running on it, I cannot just afford to upgrade GlibC, way too much hassle.

Traceback (most recent call last):

  File "/home/nvidia/ws/scripts/gpio_control_yocto.py", line 711, in <module>
    node = GPIOControl()
  File "/home/nvidia/ws/scripts/gpio_control_yocto.py", line 141, in __init__
    self.init_pwm()
  File "/home/nvidia/ws/scripts/gpio_control_yocto.py", line 238, in init_pwm
    if YAPI.RegisterHub("usb", errmsg) != YAPI.SUCCESS:
  File "/home/nvidia/.local/lib/python3.6/site-packages/yoctopuce/yocto_api.py", line 2652, in RegisterHub
    res = YAPI.InitAPI(0, errmsg)
  File "/home/nvidia/.local/lib/python3.6/site-packages/yoctopuce/yocto_api.py", line 2520, in InitAPI
    YAPI.yloadYapiCDLL()
  File "/home/nvidia/.local/lib/python3.6/site-packages/yoctopuce/yocto_api.py", line 1207, in yloadYapiCDLL
    "): " + str(ex))
ImportError: Unable to import YAPI shared library (/home/nvidia/.local/lib/python3.6/site-packages/yoctopuce/cdll/libyapi-aarch64.so): /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /home/nvidia/.local/lib/python3.6/site-packages/yoctopuce/cdll/libyapi-aarch64.so)

Current GlibC is 2.27.

I guess I'll be installing Yoctopuce from source, but it would be nice to have it backwards compatible.

Best wishes Y.

srinsoz commented 9 months ago

Hi. This issue has been identified and will be fixed soon.

srinsoz commented 8 months ago

This issue should be fixed now. Could you validate that it solve your issue?

Pnaop commented 5 months ago

I am experiencing this issue on Ubuntu 20.04 and Ubuntu 18.04 with yoctopuce 2.0.61039. It is working fine on Ubuntu 22.04

  File "/home/user/project/venv/lib/python3.9/site-packages/yoctopuce/yocto_api.py", line 1122, in yloadYapiCDLL
    YAPI._yApiCLib = ctypes.CDLL(YAPI._yApiCLibFile)
  File "/usr/lib/python3.9/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /home/user/project/venv/lib/python3.9/site-packages/yoctopuce/cdll/libyapi-amd64.so)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/project/venv/lib/python3.9/site-packages/relay_yocto_olc/yocto_relay.py", line 33, in __init__
    if YAPI.RegisterHub("usb", errmsg) != YAPI.SUCCESS:
  File "/home/user/project/venv/lib/python3.9/site-packages/yoctopuce/yocto_api.py", line 2504, in RegisterHub
    res = YAPI.InitAPI(0, errmsg)
  File "/home/user/project/venv/lib/python3.9/site-packages/yoctopuce/yocto_api.py", line 2372, in InitAPI
    YAPI.yloadYapiCDLL()
  File "/home/user/project/venv/lib/python3.9/site-packages/yoctopuce/yocto_api.py", line 1125, in yloadYapiCDLL
    raise ImportError(
ImportError: Unable to import YAPI shared library (/home/user/project/venv/lib/python3.9/site-packages/yoctopuce/cdll/libyapi-amd64.so): /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /home/user/project/venv/lib/python3.9/site-packages/yoctopuce/cdll/libyapi-amd64.so)
srinsoz commented 5 months ago

We have been able to reproduce your issue. We should have a fix very soon.

Pnaop commented 5 months ago

That's great news. Thanks for the prompt response!

For others running into similar issues, here's how I fixed it in the meantime:

  1. Download the YoctoLib.cpp source: https://www.yoctopuce.com/FR/downloads/YoctoLib.cpp.61199.zip
  2. Extract it on your machine.
  3. Because I am on Linux, I had to run sudo apt-get install libusb-1.0-0-dev
  4. Then run build.bat or build.sh depending on your platform.
  5. Wait for the compiling to be done.
  6. Now copy "libyapi.so.1.0.1", rename to "libyapi-amd64.so" and replace the incorrect shared library with it (in my case it was in: /home/user/project/venv/lib/python3.9/site-packages/yoctopuce/cdll/libyapi-amd64.so On other platforms, the names and paths will be different.

After that all worked as expected!

srinsoz commented 5 months ago

Could you validate that the following binaries are working on your computer: https://www.yoctopuce.com/FR/downloads/YoctoLib.pythonV2.61305.zip

Pnaop commented 5 months ago

I can confirm this is working on Ubuntu 20.04 after updating libyapi-amd64.so

srinsoz commented 5 months ago

Ok. We have just officially release the fix.