Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docker-base-buster][docker-config-engine-buster] No longer install Python 2 #6162

Merged
merged 17 commits into from
Dec 26, 2020
Merged

[docker-base-buster][docker-config-engine-buster] No longer install Python 2 #6162

merged 17 commits into from
Dec 26, 2020

Conversation

jleveque
Copy link
Contributor

@jleveque jleveque commented Dec 8, 2020

- Why I did it

As part of migrating SONiC codebase from Python 2 to Python 3

- How I did it

  • No longer install Python 2 in docker-base-buster or docker-config-engine-buster.
  • Install Python 2 and pip2 in the following containers until we can completely eliminate it there:
    • docker-platform-monitor
    • docker-sonic-mgmt-framework
    • docker-sonic-vs
  • Pin pip2 version <21 where it is still temporarily needed, as pip version 21 will drop support for Python 2
  • Also preform some other cleanup, ensuring that pip3, setuptools and wheel packages are installed in docker-base-buster, and then removing any attempts to re-install them in derived containers

- How to verify it

Build and run an image

- Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006

@@ -52,6 +52,9 @@ COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"]
COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"]
COPY ["root/.vimrc", "/root/.vimrc"]

RUN pip install --upgrade 'pip<21'
RUN apt-get purge -y python-pip
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why to touch it.

Copy link
Contributor Author

@jleveque jleveque Dec 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In January, pip version 21 will be released, which will drop support for Python 2. Therefore, we need to ensure we install a version < 21 for Python 2 purposes.

python-dev \
python-setuptools

RUN pip install --upgrade pip
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why we need to modify stretch docker.

Copy link
Contributor Author

@jleveque jleveque Dec 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is simply to align the way we install/upgrade pip everywhere

RUN pip install --upgrade pip

RUN apt-get purge -y python-pip
RUN apt-get install -y build-essential python-dev
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why we modify this file.

Copy link
Contributor Author

@jleveque jleveque Dec 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is simply to align the way we install/upgrade pip everywhere

@@ -341,7 +341,7 @@ RUN export VERSION=1.14.2 \
&& rm go$VERSION.linux-*.tar.gz

RUN pip3 install --upgrade pip
RUN pip2 install --upgrade pip
RUN pip2 install --upgrade 'pip<21'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why need this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In January, pip version 21 will be released, which will drop support for Python 2. Therefore, we need to ensure we install a version < 21 for Python 2 purposes.

@@ -329,7 +329,7 @@ RUN export VERSION=1.14.2 \
&& rm go$VERSION.linux-*.tar.gz

RUN pip3 install --upgrade pip
RUN pip2 install --upgrade pip
RUN pip2 install --upgrade 'pip<21'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why need this

Copy link
Contributor Author

@jleveque jleveque Dec 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In January, pip version 21 will be released, which will drop support for Python 2. Therefore, we need to ensure we install a version < 21 for Python 2 purposes.

dockers/docker-orchagent/Dockerfile.j2 Show resolved Hide resolved
scapy==2.4.4 \
pyroute2==0.5.14 \
netifaces==0.10.9 \
monotonic==1.5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have python3 < 3.3 supported? Wondering if we should use time lib directly on python 3.
https://pypi.org/project/monotonic/

Having this installed is fine to support python3 across the versions. but just to check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As stated above, I simply added this here to make the Python 3 environment in the container match the Python 2 environment, which I though would help you in your efforts to convert restore_neighbors.py to Python 3. With Python 3, we have Python 3.7 installed. I don't see any reason for us to need to support Python 3 < 3.7.

Please feel free to modify the dependencies as part of your restore_neighbors.py Python 3 pull request.

@lguohan
Copy link
Collaborator

lguohan commented Dec 13, 2020

retest vsimage please

@jleveque
Copy link
Contributor Author

Check builds are stuck in the state "Expected — Waiting for status to be reported". Force push will not fix. Closing and reopening PR in an attempt to hopefully fix.

@jleveque jleveque closed this Dec 19, 2020
@jleveque jleveque reopened this Dec 19, 2020
@svc-acs
Copy link
Collaborator

svc-acs commented Dec 19, 2020

test comment

@lguohan
Copy link
Collaborator

lguohan commented Dec 19, 2020

test

@lguohan
Copy link
Collaborator

lguohan commented Dec 20, 2020

retest vsimage please

@lguohan
Copy link
Collaborator

lguohan commented Dec 20, 2020

retest mellanox please

@lguohan
Copy link
Collaborator

lguohan commented Dec 21, 2020

retest vsimage please

@jleveque
Copy link
Contributor Author

vsimage test failing, as it relies on sonic-net/sonic-swss#1542, which will be merged as part of this submodule update: #6270

@lguohan
Copy link
Collaborator

lguohan commented Dec 24, 2020

retst vsimage please

@lguohan
Copy link
Collaborator

lguohan commented Dec 25, 2020

is it still draft?

@jleveque jleveque marked this pull request as ready for review December 25, 2020 19:32
@jleveque jleveque merged commit d40c9a1 into sonic-net:master Dec 26, 2020
@jleveque jleveque deleted the remove_py2_containers branch December 26, 2020 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants