imhamburger 님의 블로그
도커(Docker) - error: resolution-too-deep 본문
requirements.txt 에 정의된 패키지들을 도커 build 시 같이 설치하도록 하였는데 다음과 같은 에러가 발생했다.
에러메세지
[7/9] RUN pip install -r /tmp/requirements.txt -q: 2640.5
error: resolution-too-deep 2640.5 2640.5 × Dependency resolution exceeded maximum depth 2640.5
╰─> Pip cannot resolve the current dependencies as the dependency graph is too complex for pip to solve efficiently.
2640.5 2640.5 hint: Try adding lower bounds to constrain your dependencies, for example: 'package>=2.0.0' instead of just 'package'. 2640.5 2640.5
Link: https://pip.pypa.io/en/stable/topics/dependency-resolution/#handling-resolution-too-deep-errors
------ Dockerfile:17 -------------------- 15 | # Install Python dependencies for function 16 |
RUN pip install --upgrade pip -q 17 | >>> RUN pip install -r /tmp/requirements.txt -q 18 | 19 |
# Remove unused packages selenium>=4.4.3 requests>=2.28.1 boto3>=1.24.75 pandas==1.5.2 webdriver-manager==3.8.6
원인
이 에러는 pip dependency resolver가 너무 깊은 의존성 그래프를 풀다가 제한을 넘어선 경우에 발생한 경우이다.
특히 selenium, webdriver-manager, pandas, boto3 같은 패키지가 서로 다른 버전 범위를 요구할 때 자주 터진다고 한다.
- 버전 범위가 너무 넓음
- selenium>=4.4.3, requests>=2.28.1, boto3>=1.24.75 → 최신까지 다 허용하니까 충돌 가능성 ↑
- 엄격한 고정 버전과 혼용
- pandas==1.5.2는 고정인데, 다른 패키지들은 최신까지 허용 → 해결 난이도 ↑
- resolver recursion
- pip가 조합을 너무 많이 탐색하다가 제한에 걸림.
해결방법
수정 전)
selenium>=4.4.3
requests>=2.28.1
boto3>=1.24.75
pandas==1.5.2
webdriver-manager==3.8.6
수정 후)
selenium>=4.4.3,<4.13
requests>=2.28.1,<2.32
boto3>=1.24.75,<1.35
pandas==1.5.2
webdriver-manager==3.8.6'도커(Docker)' 카테고리의 다른 글
| Amazon ECR 이미지 빌드하기 (Feat. Lambda) (0) | 2025.06.07 |
|---|---|
| 도커(Docker) - 도커 컴포즈로 Nginx 로드밸런서 실행하기 (5) | 2024.10.31 |
| 도커(Docker) - Docker compose 사용하기 (0) | 2024.10.28 |
| 도커(Docker) - 같은파일인데 도커 이미지 안에서의 결과랑 내 컴퓨터에서 출력되는 결과가 다르게 나오는 오류 (2) | 2024.09.05 |
| 도커(Docker) - 명령어 모음 (1) | 2024.08.25 |