jhuopensource / semesterly

Your Semester Made Easier | Course Scheduling & Social Tools for Students
https://semester.ly
GNU General Public License v3.0
33 stars 56 forks source link

Docker build pip installation network error #1141

Closed zydtiger closed 1 month ago

zydtiger commented 1 month ago

Contact Details

No response

Describe the Bug

Running docker-compose up --build in VMware after suspending would result in the following error regarding pip3 installation failure.

 > [7/9] RUN pip3 install -v -r /code/requirements.txt:
0.653 Using pip 20.2.3 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
0.655 Non-user install because site-packages writeable
0.729 Created temporary directory: /tmp/pip-ephem-wheel-cache-dogpnono
0.729 Created temporary directory: /tmp/pip-req-tracker-z471h_0k
0.730 Initialized build tracking at /tmp/pip-req-tracker-z471h_0k
0.730 Created build tracker: /tmp/pip-req-tracker-z471h_0k
0.730 Entered build tracker: /tmp/pip-req-tracker-z471h_0k
0.730 Created temporary directory: /tmp/pip-install-tdotarwr
0.780 1 location(s) to search for versions of setuptools:
0.780 * https://pypi.org/simple/setuptools/
0.781 Fetching project page and analyzing links: https://pypi.org/simple/setuptools/
0.781 Getting page https://pypi.org/simple/setuptools/
0.782 Found index url https://pypi.org/simple
0.783 Looking up "https://pypi.org/simple/setuptools/" in the cache
0.783 Request header has "max_age" as 0, cache bypassed
0.785 Starting new HTTPS connection (1): pypi.org:443
20.81 Incremented Retry for (url='/simple/setuptools/'): Retry(total=4, connect=None, read=None, redirect=None, status=None)
20.81 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f00b47ebe80>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
20.81 Starting new HTTPS connection (2): pypi.org:443
40.83 Incremented Retry for (url='/simple/setuptools/'): Retry(total=3, connect=None, read=None, redirect=None, status=None)
41.34 WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f00b47eb700>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
41.34 Starting new HTTPS connection (3): pypi.org:443
1300.0 Incremented Retry for (url='/simple/setuptools/'): Retry(total=2, connect=None, read=None, redirect=None, status=None)
1301.0 WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f00b47f0b80>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
1301.0 Starting new HTTPS connection (4): pypi.org:443
1321.1 Incremented Retry for (url='/simple/setuptools/'): Retry(total=1, connect=None, read=None, redirect=None, status=None)
1323.1 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f00b47f08e0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
1323.1 Starting new HTTPS connection (5): pypi.org:443
1343.2 Incremented Retry for (url='/simple/setuptools/'): Retry(total=0, connect=None, read=None, redirect=None, status=None)
1347.2 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f00b47ebc10>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
1347.2 Starting new HTTPS connection (6): pypi.org:443
1367.2 Could not fetch URL https://pypi.org/simple/setuptools/: connection error: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/setuptools/ (Caused by NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f00b47ebf40>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) - skipping
1367.2 Given no hashes to check 0 links for project 'setuptools': discarding no candidates
1367.2 ERROR: Could not find a version that satisfies the requirement setuptools==65.5.1 (from -r /code/requirements.txt (line 1)) (from versions: none)
1367.2 ERROR: No matching distribution found for setuptools==65.5.1 (from -r /code/requirements.txt (line 1))
1367.2 Exception information:
1367.2 Traceback (most recent call last):
1367.2   File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 228, in _main
1367.2     status = self.run(options, args)
1367.2   File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 182, in wrapper
1367.2     return func(self, options, args)
1367.2   File "/usr/local/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 323, in run
1367.2     requirement_set = resolver.resolve(
1367.2   File "/usr/local/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 183, in resolve
1367.2     discovered_reqs.extend(self._resolve_one(requirement_set, req))
1367.2   File "/usr/local/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 388, in _resolve_one
1367.2     abstract_dist = self._get_abstract_dist_for(req_to_install)
1367.2   File "/usr/local/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 339, in _get_abstract_dist_for
1367.2     self._populate_link(req)
1367.2   File "/usr/local/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 305, in _populate_link
1367.2     req.link = self._find_requirement_link(req)
1367.2   File "/usr/local/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 270, in _find_requirement_link
1367.2     best_candidate = self.finder.find_requirement(req, upgrade)
1367.2   File "/usr/local/lib/python3.8/site-packages/pip/_internal/index/package_finder.py", line 926, in find_requirement
1367.2     raise DistributionNotFound(
1367.2 pip._internal.exceptions.DistributionNotFound: No matching distribution found for setuptools==65.5.1 (from -r /code/requirements.txt (line 1))
1367.3 1 location(s) to search for versions of pip:
1367.3 * https://pypi.org/simple/pip/
1367.3 Fetching project page and analyzing links: https://pypi.org/simple/pip/
1367.3 Getting page https://pypi.org/simple/pip/
1367.3 Found index url https://pypi.org/simple
1367.3 Looking up "https://pypi.org/simple/pip/" in the cache
1367.3 Request header has "max_age" as 0, cache bypassed
1367.3 Starting new HTTPS connection (1): pypi.org:443
1387.3 Could not fetch URL https://pypi.org/simple/pip/: connection error: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f00b47e0eb0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) - skipping
1387.3 Given no hashes to check 0 links for project 'pip': discarding no candidates
1387.3 Removed build tracker: '/tmp/pip-req-tracker-z471h_0k'
------
Dockerfile:27
--------------------
  25 |     COPY ./build/run_parser.sh /code/run_parser.sh
  26 |
  27 | >>> RUN pip3 install -v -r /code/requirements.txt
  28 |
  29 |     # Install package.json dependencies
--------------------
ERROR: failed to solve: process "/bin/sh -c pip3 install -v -r /code/requirements.txt" did not complete successfully: exit code: 1
ERROR: Service 'web' failed to build : Build failed

How can we reproduce the problem?

Steps to reproduce the behavior:

  1. Suspend VMware guest OS
  2. Run docker-compose up --build

Expected Behavior

docker-compose up --build should build and start the containers as expected.

OS Version

Linux

Which browsers are you seeing the problem on?

No response

Additional Information

No response

Code of Conduct

zydtiger commented 1 month ago

Fixed with systemctl restart docker in the guest OS. This would reset the docker daemon and networks.