Installing OPCUA python libary with pip won't work. Neither does any installation with pip
Im trying to use a Python script to get OPCUA data from a Robot and Publish it to the PLC-Next OPCUA server. Therefore I need to install the python-libary opcua. I followed the tutorial for installing pip and I am able to use pip via: /opt/bin/pip install xx. But everytime I install opcua I get following error messages:
Using cached lxml-4.6.2.tar.gz (3.2 MB)
ERROR: Command errored out with exit status 1:
command: /opt/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/var/volatile/tmp/pip-install-5cmb_7zz/lxml_03b37057bb6c4aebb82bc3a55bcbeebb/setup.py'"'"'; __file__='"'"'/var/volatile/tmp/pip-install-5cmb_7zz/lxml_03b37057bb6c4aebb82bc3a55bcbeebb/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /var/volatile/tmp/pip-pip-egg-info-l3k9buzv
cwd: /var/volatile/tmp/pip-install-5cmb_7zz/lxml_03b37057bb6c4aebb82bc3a55bcbeebb/
Complete output (3 lines):
Building lxml version 4.6.2.
Building without Cython.
Error: Please make sure the libxml2 and libxslt development packages are installed.
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/db/f7/43fecb94d66959c1e23aa53d6161231dca0e93ec500224cf31b3c4073e37/lxml-4.6.2.tar.gz#sha256=cd11c7e8d21af997ee8079037fff88f16fda188a9776eb4b81c7e4c9c0a7d7fc (from https://pypi.org/simple/lxml/) (requires-python:>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, != 3.4.*). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Over and over again.
libxml2 and libxslt are installed via the package manager, Cython is installed via pip (that worked somehow).
For Testing purposes I also tried to install other python packages like numpy or pandas but the fail aswell. I get an even longer error log there. I thin an intresting part might be:
File "numpy/core/setup.py", line 666, in get_mathlib_info
raise RuntimeError("Broken toolchain: cannot link a simple C program")
RuntimeError: Broken toolchain: cannot link a simple C program
Does someone have same problems, a solution. Or maybe just a working version with pip running. There is nothing else installed on the Controller. So resetting is no Problem!
Greetings
Comments
Hi
I don't have any PLCNext hardware yet but I think I can answer your question. You need the development packages installed, not the normal ones - (I don't know what PLCNext uses but Debian based Linux systems have the packages libxml2-dev and libxslt-dev).
Let me know if that helps
Best regards
Ian
Hi,
For a clean installation of pip you can use the following instructions. You should always install setuptools and wheels, otherwise dependency descriptions like setup.py cannot be resolved.
https://packaging.python.org/tutorials/installing-packages/
Depending on the application, I would use a python docker image here and install opcua there. This way you avoid the problem of installing python on plcnext and all the dependency stuff.
Greetings,
Jan
Hi All
I was struggling with the same problem this summer.
I could not get it to install properly on the PLCnext.
However I might have a docker image that works, it's hacked together as I needed to crossbuild the image and there is a lot of room for improvement ...
You can try your luck with this command, but keep in mind that it might not work right out the box ...
balena-engine run -it pxcbe/python-opcua:unstable /bin/bash
With the kindest regards
Dries
ps unstable has the cryptographic and crypto packages installed, but not like it should, might work, might not
Hi
It worked!
You can find the instructions here:
https://github.com/pxcbe/python-startersguide/tree/main/02_examples/04_containerized
With the kindest regards
Dries