Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Databases and Redis

pip flags pyodbc 4.0.0-unsupported and then refuses to touch it

Your error

DEPRECATION: pyodbc 4.0.0-unsupported has a non-standard version number.4 more lines it can show

Fix it fast

Most common cause, 1 of 2

An old source build of pyodbc recorded 4.0.0-unsupported as its version

While the older pip can still read the package, replace it with a release from PyPI.

Fix
python -m pip uninstall -y pyodbc
python -m pip install pyodbc
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

pyodbc 4.0.0-unsupported comes from a source build whose setup.py found neither PKG-INFO nor a git tag, so it wrote a version that breaks the packaging standard. pip 23.2 to 24.0 warned about a non-standard version number; pip 24.1 and later cannot process or uninstall it. Remove it with pip<24.1 or by deleting its files, then install a current wheel.

  • Applies to pip 26.3, pyodbc 5.5.0 on Python 3.11 to 3.15, pyodbc 5.3.0 on Python 3.9 and 3.10
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Print the pip version and the pyodbc line from the package list together. The pip version tells you whether pip can still remove the bad build (cause 1) or not (cause 2).

Run this first
python -m pip --version && python -m pip list 2>/dev/null | grep -i pyodbc

Then find the line you see in this list and open its fix:

  1. 1An old source build of pyodbc recorded 4.0.0-unsupported as its versionpip is between 23.2 and 24.0 and prints the DEPRECATION line when it installs something, while pyodbc itself still imports
  2. 2pip 24.1 or newer cannot read, upgrade or uninstall the broken buildpip uninstall answers Skipping pyodbc as it is not installed, yet pip list still shows 4.0.0-unsupported, or an install stops with invalid-installed-package

What does the error look like?

  • DEPRECATION: pyodbc 4.0.0-unsupported has a non-standard version number.
  • WARNING: Error parsing dependencies of pyodbc: Invalid version: '4.0.0-unsupported'
  • error: invalid-installed-package
  • Starting with pip 24.1, packages with invalid versions can not be processed.
  • WARNING: Skipping pyodbc as it is not installed.

Cause 1 of 2

An old source build of pyodbc recorded 4.0.0-unsupported as its version

You seepip is between 23.2 and 24.0 and prints the DEPRECATION line when it installs something, while pyodbc itself still imports

Check

The pyodbc 4.0.x setup.py first reads the version from PKG-INFO, then from git describe, and when both fail it prints a warning and uses 4.0.0-unsupported. A build from a bare source folder or archive therefore installs with that string. pip 23.2 through 24.0 flag it as a non-standard version number, a check marked to be removed in 24.1.

Check
python -c "import importlib.metadata as m; print(m.version('pyodbc'))"

Fix

While the older pip can still read the package, replace it with a release from PyPI. Current pyodbc ships prebuilt wheels with a proper version: pip picks 5.5.0 on Python 3.11 or newer and 5.3.0 on 3.9 or 3.10, so nothing is compiled locally.

Fix
python -m pip uninstall -y pyodbc
python -m pip install pyodbc

Verify

The version now prints as a normal number such as 5.5.0, and the DEPRECATION line no longer appears.

Verify
python -c "import importlib.metadata as m, pyodbc; print(m.version('pyodbc'))"

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 2

pip 24.1 or newer cannot read, upgrade or uninstall the broken build

You seepip uninstall answers Skipping pyodbc as it is not installed, yet pip list still shows 4.0.0-unsupported, or an install stops with invalid-installed-package

Check

Since pip 24.1, installed packages whose version breaks the standard are ignored by the resolver and must be uninstalled before they can be upgraded. pip's own diagnostic says the package has an invalid version and has to be removed first, and the reply on pip's issue tracker names pip<24.1, another tool, or manual deletion as the ways to do it.

Check
python -c "import pyodbc, os; print(os.path.dirname(pyodbc.__file__))"

Fix

Drop to an older pip just long enough to remove the package, then bring pip back up and install a current pyodbc. If you would rather not downgrade pip, delete the pyodbc module file and its metadata folder from the directory printed by the check.

Fix
python -m pip install "pip<24.1"
python -m pip uninstall -y pyodbc
python -m pip install --upgrade pip
python -m pip install pyodbc

# or remove it by hand (folder from the check above)
ls /path/from/check | grep -i pyodbc
rm -rf /path/from/check/pyodbc*-info /path/from/check/pyodbc*.so

Verify

pip list shows pyodbc with a normal version, and installing other packages no longer prints the invalid version warning.

Verify
python -m pip check

Confirmed by github.com

Did this fix it?

How do I stop it coming back?

  • Install pyodbc from PyPI wheels with a pinned version in requirements.txt instead of building it from a downloaded source folder.
  • Before upgrading pip across 24.1 on an old machine, run pip list and look for versions such as 4.0.0-unsupported that contain words.
  • Rebuild virtual environments from a pinned requirements file rather than copying an old site-packages folder to a new machine, so a stray source build never rides along.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine on the same stack: stegnor.com, Menulo, ShopGo.

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.