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

使用Wagtail 1.13.1本地Docker构建失败:urllib3卸载报错求助

Hey Joss, let's tackle your questions one by one:

Is urllib3 a dependency introduced by Wagtail via Requests?

Yes, exactly. For Wagtail 1.13.1, one of its core dependencies is requests>=2.11.1 (you can verify this in the official Wagtail requirements for that version). And Requests relies heavily on urllib3 as a foundational dependency—so urllib3 does come into your project indirectly through Wagtail → Requests.

That said, the root of your Docker build error is likely that your base Python image (like the official python: images) pre-installs urllib3 using distutils, not pip. Pip struggles to uninstall distutils-installed packages because it can't track all their associated files accurately.

Have other users encountered this Docker build failure issue?

Absolutely, this is a common pain point for many developers working with Docker and Python projects. The error pops up whenever pip tries to update a system-level package that was installed via distutils instead of pip. You'll find countless threads from folks hitting the same "Cannot uninstall 'urllib3'. It is a distutils installed project..." message in their build logs.

Quick Fixes to Try

Here are a few reliable solutions that work for most cases:

  • Add the --ignore-installed urllib3 flag to your pip install command: This tells pip to skip uninstalling the existing distutils-installed urllib3 and just install the version your project needs alongside it. Update your Dockerfile's install step to something like:
    RUN pip install --ignore-installed urllib3 -r requirements.txt
    
  • Pin urllib3 to the version pre-installed in your base image: Check what urllib3 version comes with your Python image (run pip show urllib3 in a temporary container of that image), then add urllib3==X.Y.Z to your requirements.txt to match it. This avoids pip trying to update the package entirely.
  • Use a different base image or install urllib3 via apt: For Debian/Ubuntu-based images, you can install urllib3 through the system package manager first (apt-get install python3-urllib3) before running pip install. This replaces the distutils version with a pip-manageable one.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.26 08:19:40