Emmélie Rousseau
Emmélie Rousseau

Reputation: 43

Unable to install cx_Oracle with pip

I am currently using the latest version of Python and attempting to install cx_Oracle through the command pip install cx_Oracle.

On my first attempt, I encountered an error that stated:

Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools".

To address this, I installed both Microsoft C++ Build Tools from this link and Visual C++ 17 from this link.

However, upon my second try, I encountered another error:

Temp\pip-install-ocqmu9mg\cx-oracle_a585471535c345cea9e48a083457ccd7\odpi\src\dpiImpl.h(34): fatal error C1083: Cannot open include file: 'stdlib.h': No such file or directory

I researched this issue by consulting this, this and this post, but none of them provided a solution for my problem.

Upvotes: 4

Views: 14797

Answers (3)

Djones4822
Djones4822

Reputation: 767

It was not made clear to me from these answers, but oracle has deprecated cx_Oracle in favor of python-oracledb. Python 3.11+ should install the new library.

cx_Oracle has a major new release under a new name and homepage python-oracledb.

The source code has moved to github.com/oracle/python-oracledb.

New projects should install python-oracledb instead of cx_Oracle. Critical patches and binary packages for new Python releases may continue to be made in the cx_Oracle namespace for a limited time, subject to demand.

However python-oracledb does not support databases older than 11.2 - to connect you will need to use python3.10 and cx_Oracle

https://github.com/oracle/python-oracledb

Upvotes: 1

Landry HABONIMANA
Landry HABONIMANA

Reputation: 11

you can install pip install oracledb

Upvotes: 1

Andreas Violaris
Andreas Violaris

Reputation: 4178

Nice effort. Unfortunately, pre-compiled binaries for Python 3.11 are not currently available.

To utilize this version, you can either wait for their release or configure your system properly to build them from source.

Alternatively, you could consider downgrading to a previous version of Python, although this is not recommended.

Upvotes: 4

Related Questions