I would like to install Python and PyPlcnextRsc on PLCnext Simulator. PLCnext Simulator doesn’t have an access to Internet, therefore standard approach described here can’t be used.
Is it possible to download python binaries and PyPlcnextRsc from somewhere, so as to copy them to PLCnext simulator?
Or is it possible to configure PLCnext simulator so as it has an Internet access?
Hello!
Actually, qemu (simulator) provide you shred internet connection of you host, but block icmp (ping) protocol by default, so you could not ‚ping google.com‘ to ensure you are online.
Also, probably you have to modify guest’s /etc/resolv.conf to provide proper dns-server for guest.
You can use ssh connection (winscp) to connect to simulator as admin@127.0.0.1:5555 (password plcnext). And transfer files you need via sftp.
And, unfortunately, all changes will be lost after simulation restart…
Best regards
Thank you very much. Indeed, the following command helped to enable DNS resolving:
**echo nameserver 8.8.8.8 > /etc/resolv.conf**
For example, the following command works fine now, requested file is being downloaded:
**curl****https://bootstrap.pypa.io/get-pip.py****-o get-pip.py**
But I didn’t succeed with the following command:
**python3 get-pip.py**
The error is the following:
**root@sim-axcf1152:/opt/plcnext# python3 get-pip.py**``**Traceback (most recent call last):**``**File "/opt/plcnext/get-pip.py", line 40, in <module>**``**import tempfile**``**ModuleNotFoundError: No module named 'tempfile'**
Looks like python3 is extremely restricted in PLCnext, without even very basic modules. I wasn’t even able to check which modules are installed, because pydoc isn’t available:
**root@sim-axcf1152:/opt/plcnext# python3**``**Python 3.10.8 (main, Oct 11 2022, 11:35:05) [GCC 11.3.0] on linux**``**Type "help", "copyright", "credits" or "license" for more information.**``**> >> help()**``**Traceback (most recent call last):**``**File "<stdin>", line 1, in <module>**``**File "/usr/lib/python3.10/_sitebuiltins.py", line 102, in __call__**``**import pydoc**``**ModuleNotFoundError: No module named 'pydoc'**``**> >>**Without pip I can’t install PyPlcnextRsc,therefore I can’t access PLCnext ports from Python…
Any ideas on how to implemet this guide using PLCnext simulator are appreciated.
There is a script which try to install apt to the plc.
https://www.plcnext-community.net/makersblog/installing-apt-get-package-manager-on-plcnext/
But there are some broken links (due to update of repo sources). So it is become tricky to resolve dependencies by hands…
Actually, I don’t know exactly what packages are optimized/reduced for simulation compare to real one fw of plc, and does this efforts be successful.
Best regards