FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
08-10-2022 05:06 PM
Hi everyone,
we are trying to create a provider in python to share our data with the data layer. The problem is that I get an error when trying to import the datalayer.
import ctrlxdatalayer
throws the error:
Intel (QEMU):
Python 3.8.10 (default, Mar 15 2022, 12:22:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctrlxdatalayer
System architecture: x86_64
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/boschrexroth/.virtualenvs/airtico-control-unit-backend/lib/python3.8/site-packages/ctrlxdatalayer/__init__.py", line 7, in <module>
from ctrlxdatalayer import client, converter, factory, provider, provider_node, \
File "/home/boschrexroth/.virtualenvs/airtico-control-unit-backend/lib/python3.8/site-packages/ctrlxdatalayer/client.py", line 9, in <module>
import ctrlxdatalayer.clib
File "/home/boschrexroth/.virtualenvs/airtico-control-unit-backend/lib/python3.8/site-packages/ctrlxdatalayer/clib.py", line 14, in <module>
libcomm_datalayer = ctypes.CDLL("libcomm_datalayer.so")
File "/usr/lib/python3.8/ctypes/__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libcomm_datalayer.so: cannot open shared object file: No such file or directory
Arm64 (Raspberry Pi):
Python 3.9.13 (main, May 23 2022, 21:57:12)
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctrlxdatalayer
System architecture: aarch64
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/dist-packages/ctrlxdatalayer/__init__.py", line 7, in <module>
from ctrlxdatalayer import client, converter, factory, provider, provider_node, \
File "/usr/local/lib/python3.9/dist-packages/ctrlxdatalayer/client.py", line 9, in <module>
import ctrlxdatalayer.clib
File "/usr/local/lib/python3.9/dist-packages/ctrlxdatalayer/clib.py", line 14, in <module>
libcomm_datalayer = ctypes.CDLL("libcomm_datalayer.so")
File "/usr/lib/python3.9/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libcrypto.so.1.1: cannot open shared object file: No such file or directory
We followed the tutorial to setup the development environment by installing all necessary libraries (https://github.com/boschrexroth/ctrlx-automation-sdk/blob/main/scripts/environment/cloud-config-amd6...) and the datalayer.deb. We also tried to QEMU environment from the repository with no success.
Are we missing something here?
Thank you
Solved! Go to Solution.
08-11-2022 09:13 AM
Hi,
could you please explain, when exactly does your error occur? (when you pack your snap? when you run it on the ctrlX CORE? when you want to run it in your App Build Environment?)
Because you talked about setting up different development environemts: I would recommend to use the ctrlX WORKS integrated App Build Environment. It is the recommended way, because a special set of software is already downloaded and other dependencies, like the SDK itself can get downloaded easily with the help of installation scripts.
One additional hint: some information about the Python samples included in the SDK can be found here.
Best regards,
Nick
08-11-2022 09:42 AM - edited 08-11-2022 09:43 AM
Hey, thank you for your fast response.
The error occurs when we try to run our app in the development environment.
Thank you for your hints. We started to setup a dev environment manually because we don't use Windows computers and so the ctrlX Works software is not working for us. First we tried a solution by using a Raspberry Pi with Ubuntu 20 (Arm64) for development and for building our snaps. Everything worked fine until we wanted to include the datalayer in our application.
Because that didn't work we setup a QEMU environment with the scripts provided in the ctrlx automation sdk folder but with the same result (like we shown in the error code snippets above)
Best regards,
Benni
08-11-2022 11:02 AM - edited 08-11-2022 11:03 AM
Hi Benni,
thanks for the details. To run python in your build environment you would need to set up a virtual python environment and install the packages libzmq5 and ctrlX Data Layer. A description can be found on PyPi.org.
You can take a look at the samples included in the SDK, how its done here. In every sample which uses the Data Layer we have a script called "install-venv.sh". If you execute this scipt it will create and activate a virtual Python environment for your project. It also installes all the requiered packages (in our samples they are defined in the "requirements.txt" file). Further a subfolder "venv/" will be created and activated as virtual environment which contains the Python runtime and all required packages. Please see the documentation on that here.
Best regards,
Nick
08-11-2022 01:53 PM
We are already using a venv (in the QEMU setup) with no success. I also tried it on the Raspberry Pi with no success.
What we did:
source venv/bin/activate
python3
import ctrlxdatalayer
Python 3.9.13 (main, May 23 2022, 21:57:12)
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctrlxdatalayer
System architecture: aarch64
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/dist-packages/ctrlxdatalayer/__init__.py", line 7, in <module>
from ctrlxdatalayer import client, converter, factory, provider, provider_node, \
File "/usr/local/lib/python3.9/dist-packages/ctrlxdatalayer/client.py", line 9, in <module>
import ctrlxdatalayer.clib
File "/usr/local/lib/python3.9/dist-packages/ctrlxdatalayer/clib.py", line 14, in <module>
libcomm_datalayer = ctypes.CDLL("libcomm_datalayer.so")
File "/usr/lib/python3.9/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libcrypto.so.1.1: cannot open shared object file: No such file or directory
I also checked teh GLIBCXX.
strings /usr/lib/aarch64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
with the response
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBCXX_3.4.26
GLIBCXX_3.4.27
GLIBCXX_3.4.28
GLIBCXX_3.4.29
GLIBCXX_3.4.30
GLIBCXX_DEBUG_MESSAGE_LENGTH
I am using a Arm64 architecture so the path to libstdc++.so.6 is differnt.
I managed to get it run on my QEMU environment with amd64 architecture.I missed to step to install the datalayer dev here.
Is arm64 not supported for the datalayer in the development environment?
Best regards,
Benni
08-11-2022 03:11 PM
Hi Benni,
Great, that you were able to run it with the QEMU (amd64) environment.
Regarding your arm64 environment: could you check if you got the libcrypto.so.1.1? It should be located somewhere at "usr/lib/aarch64-linux-gnu". It seems to be missing, at least the error message says so.
Best regards,
Nick
08-12-2022 09:42 AM
Hi Benni,
I just found time to test it on a Raspi (ubuntu 20 server). It worked for me.
Are you sure you run it with python and the activated virtual environment. In my screenshot below you see the difference. If I run it with venv not activated, I get a similar error. (Please ignore the error I got, because no real ctrlX CORE was connected wit TCP).
Best regards,
Nick
08-12-2022 10:06 AM - edited 08-12-2022 10:08 AM
I reinstalled ubuntu server 20 on my pi and made the setup steps again. Now it is working (even without a venv).
Thank you for your help. I think i missed something in my first try but i don't know what.
Best regards,
Benni