Add Python3 packages to sonic-mgmt-docker (#15726)

Why I did it
This is part of sonic-mgmt-docker Python3 migration project.
Currently Python3 packages are in the Python3 virtual environment. This PR will add Python3 packages to real file system.
After we migrate all script to use Python3 in real file system, the Python3 venv will be deleted.

After this PR, in sonic-mgmt-docker,
Directly run cmd - pytest will use Python2's version.
python3 -m pytest will use Python3's version.

How I did it
Modify sonic-mgmt-docker j2 script.

How to verify it
Build a private sonic-mgmt-docker and run basic test case with Python3.
This commit is contained in:
ShiyanWangMS 2023-07-11 09:54:10 +08:00 committed by GitHub
parent 72021fdb0f
commit c58923053a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,6 +38,80 @@ RUN apt-get update && apt-get install -y apt-transport-https \
telnet \
vim
RUN pip3 install --upgrade pip setuptools wheel
RUN pip3 install aiohttp \
allure-pytest==2.8.22 \
ansible==2.9.27 \
azure-storage-blob==12.9.0 \
azure-kusto-data \
azure-kusto-ingest \
defusedxml \
celery[redis]==4.4.7 \
cffi \
contextlib2==0.6.0.post1 \
cryptography==3.3.2 \
dpkt \
"future>=0.16.0" \
gitpython \
ipaddr \
ipython==5.4.1 \
ixnetwork-restpy==1.0.64 \
ixnetwork-open-traffic-generator==0.0.79 \
jinja2==2.10.1 \
jsonpatch \
lxml \
markupsafe==2.0.1 \
mock \
msrest==0.6.21 \
natsort \
ncclient \
netaddr \
netmiko==2.4.2 \
paramiko==2.7.1 \
passlib \
pexpect \
prettytable \
psutil \
ptf \
pyasn1==0.4.8 \
pycryptodome==3.9.8 \
pyfiglet \
pylint==1.8.1 \
pyro4 \
pysnmp==4.4.12 \
pysubnettree \
pytest-ansible \
pytest-html \
pytest-repeat \
pytest-xdist==1.28.0 \
python-dateutil \
pytest==7.1.3 \
redis \
requests \
retry \
rpyc \
scandir \
scapy==2.4.5 \
setuptools-rust \
six \
snappi[ixnetwork,convergence]==0.7.44 \
tabulate \
textfsm==1.1.2 \
thrift==0.11.0 \
virtualenv \
&& wget https://github.com/nanomsg/nanomsg/archive/1.2.tar.gz \
&& tar xvfz 1.2.tar.gz \
&& cd nanomsg-1.2 \
&& mkdir -p build \
&& cd build \
&& cmake .. \
&& make install \
&& ldconfig \
&& cd ../.. \
&& rm -fr nanomsg-1.2 \
&& rm -f 1.2.tar.gz \
&& pip3 install nnpy
RUN curl -fsSL http://archive.ubuntu.com/ubuntu/pool/universe/s/scapy/python-scapy_2.3.3-3_all.deb \
--output python-scapy_2.3.3-3_all.deb \
&& dpkg -i python-scapy_2.3.3-3_all.deb \
@ -72,6 +146,7 @@ RUN pip install allure-pytest==2.8.22 \
natsort \
netaddr \
netmiko==2.4.2 \
nnpy \
paramiko==2.7.1 \
passlib \
pexpect \
@ -108,18 +183,6 @@ RUN pip install allure-pytest==2.8.22 \
&& python setup.py install \
&& cd .. \
&& rm -fr scapy-vxlan \
&& wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \
&& tar xvfz 1.0.0.tar.gz \
&& cd nanomsg-1.0.0 \
&& mkdir -p build \
&& cd build \
&& cmake .. \
&& make install \
&& ldconfig \
&& cd ../.. \
&& rm -fr nanomsg-1.0.0 \
&& rm -f 1.0.0.tar.gz \
&& pip install nnpy \
&& pip install scapy==2.4.5 --upgrade --ignore-installed
# Install docker-ce-cli