Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages

Databases and Redis · Comparison

pip install cx_Oracle asks for Microsoft Visual C++ 14.0 on Windows

Short answer

Microsoft Visual C++ 14.0 or greater is required appears because cx_Oracle 8.3.0, its last release, has Windows wheels only for Python 3.6 to 3.10. On Python 3.11 and later pip downloads the source and setuptools cannot find a compiler. Install python-oracledb 26.1 instead, which has wheels for Python 3.10 to 3.15, and change import cx_Oracle to import oracledb.

  • Applies to python-oracledb 26.1.0, cx_Oracle 8.3.0, Python 3.10 to 3.15 on Windows, pip 26.3
  • Updated
  • By Maaz Zindani, Senior Software Engineer

The compiler message is a side effect. pip could not find a ready-made Windows wheel for cx_Oracle that matches your Python, so it downloaded the source and asked setuptools to compile it, and setuptools found no Microsoft C++ compiler. The last cx_Oracle release, 8.3.0, has Windows wheels only up to Python 3.10, so any newer interpreter lands here.

Installing the build tools can work, but the better route is to leave the old driver. Oracle's own documentation calls cx_Oracle obsolete and names python-oracledb as its renamed successor, and that package installs from wheels on current Pythons with no compiler and no Oracle Client download.

At a glance

What each package gives a Windows user on a current Python
cx_Oracle 8.3.0python-oracledb 26.1
Windows wheelsCPython 3.6 to 3.10CPython 3.10 to 3.15
On Python 3.11 or newerBuilds from source, needs the C++ build toolsInstalls a wheel, nothing to compile
Oracle Client librariesAlways requiredOnly for the optional Thick mode
Oldest database reached by defaultDepends on the client libraries installedOracle Database 12.1 in Thin mode
Import name`import cx_Oracle``import oracledb`
StatusObsolete, not for new developmentMaintained by Oracle

Dry-run both packages to find the missing wheel

Ask pip to resolve each package from prebuilt files only. --dry-run installs nothing, and --only-binary=:all: forbids source builds, so a package with no matching wheel fails immediately and shows which of the two is the problem.

Dry run, one package at a time

python --version
python -m pip install --dry-run --only-binary=:all: cx_Oracle
python -m pip install --dry-run --only-binary=:all: oracledb

Move the project to python-oracledb

Install the new package, then change the import. For a large codebase the quickest switch is an alias, so the rest of the file keeps saying cx_Oracle while the new driver runs underneath.

One behavior change matters when you touch connection code: python-oracledb requires keyword arguments in connect(), Connection() and SessionPool(). A call such as connect(user, pw, dsn) with positional values no longer works; it has to name user, password and dsn.

Install, then alias or rename the import

python -m pip install oracledb --upgrade

# quickest switch for existing code
import oracledb as cx_Oracle

# new code
import oracledb
conn = oracledb.connect(user="hr", password=pw, dsn="localhost/orclpdb")

Oracle's upgrade appendix also says the encoding and nencoding parameters are desupported and must be removed from connect and pool calls.

What Thin mode changes for you

By default python-oracledb talks to the database directly in Thin mode, so there is no Oracle Instant Client to download and no PATH to edit. Thin mode connects to Oracle Database 12.1 or later.

For an older database, or a feature that only exists in Thick mode, you must install Oracle Client libraries and enable Thick mode. That is a separate setup with its own error messages, so treat it as a second project rather than part of this fix.

If python-oracledb also fails to install

Then your interpreter or architecture has no published wheel either. The usual cases are a pre-release Python, or a very new Python that the package has not caught up with. The documentation lists the supported range as Python 3.10 through 3.15.

Install a supported CPython from python.org that matches a wheel and run the dry run again. Only if you truly need a source build, install Microsoft C++ Build Tools as the error text says, and retry the same pip command.

See what you are on, then demand a wheel

python -c "import sys, platform; print(sys.version, platform.machine())"
python -m pip install --only-binary=:all: oracledb

Import oracledb and look for the .whl in the pip output

The new driver should import and report its version, and the pip output should have shown a downloaded .whl file rather than a Building wheel step.

Import and version

python -c "import oracledb"
python -m pip show oracledb

Keep the error from coming back in build scripts

  • Replace cx_Oracle with oracledb in requirements files before moving a project past Python 3.10.
  • Add --only-binary=:all: to the pip step of Windows build scripts so a missing wheel fails at once with a clear message instead of a compiler error.
  • Check the wheel list for every Python version and architecture you deploy to before you pin a release.

Which to pick

  • The error means no wheel, not a broken machine.
  • cx_Oracle stops at Python 3.10 on Windows; python-oracledb covers 3.10 to 3.15.
  • Switch the import and use keyword arguments in connect calls.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. 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.

Next step

Want a second pair of eyes on it?

Send me the error and what changed before it started. I reply within 24 hours.