Makers Blog

Installing PIP on PLCnext Control

stijn 03 November 2021 min. read
5,696 views 1 comments

What if you do not need a newer version of Python than the one that comes preinstalled on the controller, but you do want pip installed? There is a simple way to do so!

You can download the installation script via the curl command:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

The above command downloads an installation file to the current directory which you can execute with the following command:

python3 get-pip.py

This will install pip on your controller together with wheel and setuptools.

If you wish not to install these, you can install pip with the following command:

python3 get-pip.py --no-wheel --no-setuptools

Discussion

Please login/register to comment
Login/Register

Leave a Reply

Your email address will not be published. Required fields are marked *

ayoub 04.03.2022

Hello I have an issue with permission. When I did run "python3 get-pip.py" I got the following error. epiroc@axcf2152:~$ python3 get-pip.py Defaulting to user installation because normal site-packages is not writeable Collecting pip Using cached pip-22.0.3-py3-none-any.whl (2.1 MB) Collecting setuptools Using cached setuptools-60.9.3-py3-none-any.whl (1.1 MB) Collecting wheel Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB) Installing collected packages: wheel, setuptools, pip ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/opt/plcnext/.local/lib' Check the permissions. When I used "sudo python3 get-pip.py" It seems that I cannot reach to all folders. Although, my user is set as admin. epiroc@axcf2152:~$ sudo python3 get-pip.py Password: Sorry, user epiroc is not allowed to execute '/usr/bin/python3 get-pip.py' as root on axcf2152. I login with admin user and used the password that was typed on the PLC I had the same issue. I would be appreciated it if you could help.

Login / Register to reply
Martin PLCnext Team 21.04.2022

It worked for me, as admin, from the /opt/plcnext directory. The output from the commands is shown below. ================================= admin@axcf2152:/opt/plcnext$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2596k 100 2596k 0 0 762k 0 0:00:03 0:00:03 --:--:-- 763k admin@axcf2152:/opt/plcnext$ python3 get-pip.py Defaulting to user installation because normal site-packages is not writeable Collecting pip Downloading pip-22.0.4-py3-none-any.whl (2.1 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 755.7 kB/s eta 0:00:00 Collecting wheel Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB) Installing collected packages: wheel, pip WARNING: The script wheel is installed in '/opt/plcnext/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The scripts pip, pip3 and pip3.8 are installed in '/opt/plcnext/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed pip-22.0.4 wheel-0.37.1

Newsletter
Never miss a new article
Sign up for the newsletter
Never miss news about PLCnext Technology
Get interesting content via newsletter four times a year
Receive exclusive information before all other users