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.
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
| cx_Oracle 8.3.0 | python-oracledb 26.1 | |
|---|---|---|
| Windows wheels | CPython 3.6 to 3.10 | CPython 3.10 to 3.15 |
| On Python 3.11 or newer | Builds from source, needs the C++ build tools | Installs a wheel, nothing to compile |
| Oracle Client libraries | Always required | Only for the optional Thick mode |
| Oldest database reached by default | Depends on the client libraries installed | Oracle Database 12.1 in Thin mode |
| Import name | `import cx_Oracle` | `import oracledb` |
| Status | Obsolete, not for new development | Maintained 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: oracledbMove 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: oracledbImport 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 oracledbKeep the error from coming back in build scripts
- Replace
cx_Oraclewithoracledbin 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.