Skip to content
New issue

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

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

Already on GitHub? # to your account

[build] Fix base OS compilation issue caused by incompatibility of urllib with requests. #2830

Merged

Conversation

oleksandrivantsiv
Copy link
Collaborator

@oleksandrivantsiv oleksandrivantsiv commented May 5, 2023

What I did

Fix SONiC image compilation issue:

[2023-05-03T17:54:00.146Z] + sudo cp files/build_templates/docker_image_ctl.j2 ./fs********-mellanox/usr/share/sonic/templates/docker_image_ctl.j2
[2023-05-03T17:54:00.146Z] + sudo LANG=C DOCKER_HOST= ch******** ./fs********-mellanox /usr/local/bin/generate_shutdown_order.py
[2023-05-03T17:54:00.146Z] Traceback (most recent call last):
[2023-05-03T17:54:00.146Z]   File "/usr/local/lib/python3.9/dist-packages/docker/api/client.py", line 214, in _retrieve_server_version
[2023-05-03T17:54:00.146Z]     return self.version(api_version=False)["ApiVersion"]
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/docker/api/daemon.py", line 181, in version
[2023-05-03T17:54:00.147Z]     return self._result(self._get(url), json=True)
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/docker/utils/decorators.py", line 46, in inner
[2023-05-03T17:54:00.147Z]     return f(self, *args, **kwargs)
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/docker/api/client.py", line 237, in _get
[2023-05-03T17:54:00.147Z]     return self.get(url, **self._set_request_timeout(kwargs))
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/requests/sessions.py", line 600, in get
[2023-05-03T17:54:00.147Z]     return self.request("GET", url, **kwargs)
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/requests/sessions.py", line 587, in request
[2023-05-03T17:54:00.147Z]     resp = self.send(prep, **send_kwargs)
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/requests/sessions.py", line 701, in send
[2023-05-03T17:54:00.147Z]     r = adapter.send(request, **kwargs)
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/requests/adapters.py", line 486, in send
[2023-05-03T17:54:00.147Z]     resp = conn.urlopen(
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/urllib3/connectionpool.py", line 790, in urlopen
[2023-05-03T17:54:00.147Z]     response = self._make_request(
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/urllib3/connectionpool.py", line 496, in _make_request
[2023-05-03T17:54:00.147Z]     conn.request(
[2023-05-03T17:54:00.147Z] TypeError: request() got an unexpected keyword argument 'chunked'

How I did it

Pin urllib to version < 2 as it was suggested in docker/docker-py#3113.

How to verify it

Run SONiC image compilation.

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

@oleksandrivantsiv oleksandrivantsiv self-assigned this May 5, 2023
@liushilongbuaa
Copy link
Contributor

It didn't work.

…requests >= 2.29.0.

- Pin urllib to older version from 2.0.0

Signed-off-by: Oleksandr Ivantsiv <oivantsiv@nvidia.com>
Co-authored-by: davidza@nvidia.com
@oleksandrivantsiv oleksandrivantsiv force-pushed the request-fixed-version branch 3 times, most recently from ec0596f to bfcaa8c Compare May 5, 2023 12:50
@oleksandrivantsiv
Copy link
Collaborator Author

@liushilongbuaa now it is fixed

@oleksandrivantsiv oleksandrivantsiv changed the title [build] Fix base OS compilation issue caused by incompatibility with requests >= 2.29.0 [build] Fix base OS compilation issue caused by incompatibility urllib with requests >= 2.29.0 May 5, 2023
@anamehra
Copy link
Contributor

anamehra commented May 5, 2023

We are seeing this failure on 202205 as well, please add the fix there too.
@abdosi , FYI.

@qiluo-msft
Copy link
Contributor

I see a new release hours ago: https://github.com/docker/docker-py/releases/tag/6.1.0
Could you check whether it really "Support for requests 2.29.0+ and urllib3 2.x"?

@oleksandrivantsiv oleksandrivantsiv force-pushed the request-fixed-version branch from bfcaa8c to 92f8aa7 Compare May 7, 2023 21:15
@oleksandrivantsiv oleksandrivantsiv changed the title [build] Fix base OS compilation issue caused by incompatibility urllib with requests >= 2.29.0 [build] Fix base OS compilation issue caused by incompatibility of older versions of urllib with requests. May 7, 2023
@oleksandrivantsiv oleksandrivantsiv marked this pull request as draft May 7, 2023 21:42
@oleksandrivantsiv oleksandrivantsiv marked this pull request as ready for review May 7, 2023 22:13
@oleksandrivantsiv oleksandrivantsiv marked this pull request as draft May 7, 2023 22:43
@oleksandrivantsiv oleksandrivantsiv force-pushed the request-fixed-version branch from 92f8aa7 to bfcaa8c Compare May 7, 2023 23:26
@oleksandrivantsiv oleksandrivantsiv changed the title [build] Fix base OS compilation issue caused by incompatibility of older versions of urllib with requests. [build] Fix base OS compilation issue caused by incompatibility of urllib with requests. May 7, 2023
@oleksandrivantsiv oleksandrivantsiv marked this pull request as ready for review May 7, 2023 23:46
@oleksandrivantsiv
Copy link
Collaborator Author

@qiluo-msft requests 2.29.0+ and urllib3 2.x doesn't work in the SONiC environment. I got the same error.
The current fix seems to be the correct one.
Redis-py fixed the issue in the same way: redis/redis-py#2748

@keboliu keboliu requested a review from liushilongbuaa May 8, 2023 02:00
@liushilongbuaa
Copy link
Contributor

https://dev.azure.com/mssonic/build/_build/results?buildId=268185&view=results
Yesterdays' PR check passed. Maybe it is fixed?

@keboliu
Copy link
Collaborator

keboliu commented May 8, 2023

https://dev.azure.com/mssonic/build/_build/results?buildId=268185&view=results Yesterdays' PR check passed. Maybe it is fixed?

Hi @liushilongbuaa I still see the same issue in my local build environment.

@liushilongbuaa
Copy link
Contributor

liushilongbuaa commented May 8, 2023

It is already fixed by docker's new release.

Installed /__w/1/s/.eggs/docker_image_py-0.1.12-py3.9.egg
Searching for docker>=4.4.4
Reading https://pypi.org/simple/docker/
Downloading https://files.pythonhosted.org/packages/b6/21/6b7450980b84c435ac4b58ad6b291c99b506d07a261bafe2bd96ecbc68bd/docker-6.1.1-py3-none-any.whl#sha256=8308b23d3d0982c74f7aa0a3abd774898c0c4fba006e9c3bde4f68354e470fe2
Best match: docker 6.1.1

@@ -221,6 +221,7 @@
},
install_requires=[
'click==7.0',
'urllib3<2',
'click-log>=0.3.2',
'docker>=4.4.4',
Copy link
Contributor

Choose a reason for hiding this comment

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

docker>=6.1.1

@@ -221,6 +221,7 @@
},
install_requires=[
'click==7.0',
'urllib3<2',
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't need to limit urllib3 now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @liushilongbuaa seems it's not fixed, I still see same issue in my local build, and it also failed the checker of PR sonic-net/sonic-swss#2763.

@stephenxs
Copy link
Collaborator

A similar issue is also observed in the swss vstest: https://dev.azure.com/mssonic/be1b070f-be15-4154-aade-b1d3bfb17054/_apis/build/builds/268784/logs/95

@qiluo-msft qiluo-msft merged commit 71ef4f1 into sonic-net:master May 8, 2023
StormLiangMS pushed a commit that referenced this pull request May 9, 2023
…requests >= 2.29.0. (#2830)

#### What I did
Fix SONiC image compilation issue:
```
[2023-05-03T17:54:00.146Z] + sudo cp files/build_templates/docker_image_ctl.j2 ./fs********-mellanox/usr/share/sonic/templates/docker_image_ctl.j2
[2023-05-03T17:54:00.146Z] + sudo LANG=C DOCKER_HOST= ch******** ./fs********-mellanox /usr/local/bin/generate_shutdown_order.py
[2023-05-03T17:54:00.146Z] Traceback (most recent call last):
[2023-05-03T17:54:00.146Z]   File "/usr/local/lib/python3.9/dist-packages/docker/api/client.py", line 214, in _retrieve_server_version
[2023-05-03T17:54:00.146Z]     return self.version(api_version=False)["ApiVersion"]
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/docker/api/daemon.py", line 181, in version
[2023-05-03T17:54:00.147Z]     return self._result(self._get(url), json=True)
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/docker/utils/decorators.py", line 46, in inner
[2023-05-03T17:54:00.147Z]     return f(self, *args, **kwargs)
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/docker/api/client.py", line 237, in _get
[2023-05-03T17:54:00.147Z]     return self.get(url, **self._set_request_timeout(kwargs))
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/requests/sessions.py", line 600, in get
[2023-05-03T17:54:00.147Z]     return self.request("GET", url, **kwargs)
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/requests/sessions.py", line 587, in request
[2023-05-03T17:54:00.147Z]     resp = self.send(prep, **send_kwargs)
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/requests/sessions.py", line 701, in send
[2023-05-03T17:54:00.147Z]     r = adapter.send(request, **kwargs)
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/requests/adapters.py", line 486, in send
[2023-05-03T17:54:00.147Z]     resp = conn.urlopen(
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/urllib3/connectionpool.py", line 790, in urlopen
[2023-05-03T17:54:00.147Z]     response = self._make_request(
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/urllib3/connectionpool.py", line 496, in _make_request
[2023-05-03T17:54:00.147Z]     conn.request(
[2023-05-03T17:54:00.147Z] TypeError: request() got an unexpected keyword argument 'chunked'
```

#### How I did it
Pin urllib to version < 2 as it was suggested in docker/docker-py#3113.

#### How to verify it
Run SONiC image compilation.
@anamehra
Copy link
Contributor

Hi @abdosi , please help to get this one in 202205.

@rlhui
Copy link
Contributor

rlhui commented May 12, 2023

Hi @abdosi , please help to get this one in 202205.

@yxieca please help on this one, thanks

@msosyak
Copy link

msosyak commented May 12, 2023

@qiluo-msft What is needed to trigger sonic-utilities submodule update in sonic-buildimage repo? Could you help with it, please?

@yxieca
Copy link
Contributor

yxieca commented May 17, 2023

@oleksandrivantsiv @liushilongbuaa do we still need to cherry-pick this change? Do we need this change at all?

@liushilongbuaa
Copy link
Contributor

Yes. We need.
Local build maybe fails. But it doesn't affect our pipeline.

@yxieca
Copy link
Contributor

yxieca commented May 20, 2023

Yes. We need. Local build maybe fails. But it doesn't affect our pipeline.

I thought locking docker to 6.1.1 should have fixed it? @liushilongbuaa

@liushilongbuaa
Copy link
Contributor

Yes. We need. Local build maybe fails. But it doesn't affect our pipeline.

I thought locking docker to 6.1.1 should have fixed it? @liushilongbuaa

docker 6.1.1 will fix the issue.
So, Line:225 change to docker>=6.1.0 may be better.

@yxieca
Copy link
Contributor

yxieca commented May 26, 2023

Removed cherry-pick flag according to Shilong's comment.

pdhruv-marvell pushed a commit to pdhruv-marvell/sonic-utilities that referenced this pull request Aug 23, 2023
…requests >= 2.29.0. (sonic-net#2830)

#### What I did
Fix SONiC image compilation issue:
```
[2023-05-03T17:54:00.146Z] + sudo cp files/build_templates/docker_image_ctl.j2 ./fs********-mellanox/usr/share/sonic/templates/docker_image_ctl.j2
[2023-05-03T17:54:00.146Z] + sudo LANG=C DOCKER_HOST= ch******** ./fs********-mellanox /usr/local/bin/generate_shutdown_order.py
[2023-05-03T17:54:00.146Z] Traceback (most recent call last):
[2023-05-03T17:54:00.146Z]   File "/usr/local/lib/python3.9/dist-packages/docker/api/client.py", line 214, in _retrieve_server_version
[2023-05-03T17:54:00.146Z]     return self.version(api_version=False)["ApiVersion"]
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/docker/api/daemon.py", line 181, in version
[2023-05-03T17:54:00.147Z]     return self._result(self._get(url), json=True)
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/docker/utils/decorators.py", line 46, in inner
[2023-05-03T17:54:00.147Z]     return f(self, *args, **kwargs)
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/docker/api/client.py", line 237, in _get
[2023-05-03T17:54:00.147Z]     return self.get(url, **self._set_request_timeout(kwargs))
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/requests/sessions.py", line 600, in get
[2023-05-03T17:54:00.147Z]     return self.request("GET", url, **kwargs)
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/requests/sessions.py", line 587, in request
[2023-05-03T17:54:00.147Z]     resp = self.send(prep, **send_kwargs)
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/requests/sessions.py", line 701, in send
[2023-05-03T17:54:00.147Z]     r = adapter.send(request, **kwargs)
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/requests/adapters.py", line 486, in send
[2023-05-03T17:54:00.147Z]     resp = conn.urlopen(
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/urllib3/connectionpool.py", line 790, in urlopen
[2023-05-03T17:54:00.147Z]     response = self._make_request(
[2023-05-03T17:54:00.147Z]   File "/usr/local/lib/python3.9/dist-packages/urllib3/connectionpool.py", line 496, in _make_request
[2023-05-03T17:54:00.147Z]     conn.request(
[2023-05-03T17:54:00.147Z] TypeError: request() got an unexpected keyword argument 'chunked'
```

#### How I did it
Pin urllib to version < 2 as it was suggested in docker/docker-py#3113.

#### How to verify it
Run SONiC image compilation.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.