You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Dockerfile中setuptools显v3.3但实际为v20.7.0,构建镜像遇问题求助

Fixing Setuptools Version Mismatch in Liveblog Docker Build (Ubuntu 16.04)

Hey, let's sort out this setuptools version problem you're hitting when building the liveblog Docker image on Ubuntu 16.04. From your build output, it looks like even though your Dockerfile specifies setuptools==3.3, dependencies like cryptography or boto3 are causing pip to auto-upgrade setuptools to v20.7.0. Here's how to fix that:

1. Pin pip and Setuptools Correctly in Dockerfile

First, find where setuptools is installed in your Dockerfile. Chances are it's a line like:

RUN pip install setuptools==3.3

The issue is that newer pip versions might force a setuptools upgrade, and some dependencies trigger this too. Let's fix it by first installing a pip version that's compatible with setuptools 3.3 (pip 9.0.1 is a safe bet), then force-reinstall the exact setuptools version:

# Install pip version compatible with setuptools 3.3
RUN pip install pip==9.0.1
# Force reinstall to lock in setuptools 3.3
RUN pip install --force-reinstall setuptools==3.3

2. Use a Constraint File to Prevent Upgrades

Next, create a constraints.txt file in your project root (same directory as Dockerfile) with this single line:

setuptools==3.3

This tells pip to never upgrade setuptools, no matter what dependencies request. Update your Dockerfile's pip install command to use this constraint:

RUN pip install -r /tmp/requirements.txt -c constraints.txt

3. Rebuild and Verify

Run your build command again:

docker build .

Watch the output to confirm setuptools stays at v3.3—you shouldn't see it being upgraded to 20.7.0 anymore.

If you still have trouble, make sure there aren't other commands in your Dockerfile that might upgrade pip or setuptools later on (like a stray pip install --upgrade pip that would pull in a newer pip which requires a higher setuptools version).

内容的提问来源于stack exchange,提问作者Fabian

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 02:33:39