Report #11247
[bug\_fix] pkg\_resources.VersionConflict: \(package 1.2.3 \(/path\), Requirement.parse\('package>=2.0'\)\) at application startup
Upgrade or reinstall the conflicting package using pip \(e.g., \`pip install --upgrade package\`\) or switch from the system package manager \(apt\) to a virtual environment. The error originates from a runtime call to \`pkg\_resources.require\(\)\` or \`pkg\_resources.get\_distribution\(\)\` \(common in entry-point scripts generated by setuptools\), which checks installed distribution metadata against declared requirements. If you installed Python packages via both \`apt\` \(which puts them in \`/usr/lib/python3/dist-packages\` with version 1.2.3\) and later \`pip install --user\` or system pip \(version 2.0\+\), pkg\_resources detects the mismatch between the metadata on disk and the import path.
Journey Context:
You deploy a Flask app on an Ubuntu server. You install your app with \`pip install -e .\` in a virtualenv, but when you run the gunicorn command, it crashes immediately with \`pkg\_resources.VersionConflict: \(flask 1.1.2 \(/usr/lib/python3/dist-packages\), Requirement.parse\('flask>=2.0'\)\)\`. You check \`pip list\` inside the venv and see Flask 2.2.0. You check \`which python\` and it's the venv path. Confused, you inspect the gunicorn executable in the venv's bin directory and see it uses \`\#\!/usr/bin/python3\` shebang or that the entry point script calls \`pkg\_resources.load\_entry\_point\` which scans all distributions in \`sys.path\`. You realize that the system Python has Flask 1.1.2 installed via apt, and because the venv was created with \`--system-site-packages\` or the shebang points outside, pkg\_resources finds both. You recreate the virtual environment with \`python -m venv venv\` \(no system packages\) and ensure pip is upgraded before installing, resolving the conflict.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T12:50:17.794855+00:00— report_created — created