oracle / python-cx_Oracle

Python interface to Oracle Database now superseded by python-oracledb
https://oracle.github.io/python-cx_Oracle
Other
888 stars 361 forks source link

Trying to install cx-oracle with Python 3.9 and getting errors #493

Closed Belfor-IT closed 3 years ago

Belfor-IT commented 3 years ago

Hi All,

Trying to install cx-oracle with the latest python version 3.9.0 on windows 10 "Pip install cx-oracle" getting the error below

`ERROR: Command errored out with exit status 1: command: 'c:\users\user\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\user\AppData\Local\Temp\pip-install-or0h8i5a\cx-oracle\setup.py'"'"'; file='"'"'C:\Users\user\AppData\Local\Temp\pip-install-or0h8i5a\cx-oracle\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\user\AppData\Local\Temp\pip-record-9t89nyln\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\users\appdata\local\programs\python\python39\Include\cx-oracle' cwd: C:\Users\users\AppData\Local\Temp\pip-install-or0h8i5a\cx-oracle\ Complete output (14 lines): running install running build running build_ext building 'cx_Oracle' extension creating build creating build\temp.win-amd64-3.9 creating build\temp.win-amd64-3.9\Release creating build\temp.win-amd64-3.9\Release\odpi creating build\temp.win-amd64-3.9\Release\odpi\src creating build\temp.win-amd64-3.9\Release\src C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DCXO_BUILD_VERSION=8.0.1 -Iodpi/include -Iodpi/src -Ic:\users\user\appdata\local\programs\python\python39\include -Ic:\users\user\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include /Tcodpi\src\dpiConn.c /Fobuild\temp.win-amd64-3.9\Release\odpi\src\dpiConn.obj dpiConn.c C:\Users\users\AppData\Local\Temp\pip-install-or0h8i5a\cx-oracle\odpi\src\dpiImpl.h(34): fatal error C1083: Cannot open include file: 'stdlib.h': No such file or directory error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\cl.exe' failed with exit code 2

ERROR: Command errored out with exit status 1: 'c:\users\user\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\user\AppData\Local\Temp\pip-install-or0h8i5a\cx-oracle\setup.py'"'"'; file='"'"'C:\Users\user\AppData\Local\Temp\pip-install-or0h8i5a\cx-oracle\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\user\AppData\Local\Temp\pip-record-9t89nyln\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\user\appdata\local\programs\python\python39\Include\cx-oracle' Check the logs for full command output.`

With Python 3.8.0 I'm not getting this error

anthony-tuininga commented 3 years ago

No precompiled binaries are available for Python 3.9 yet. So you will need to wait until those are available or have your machine configured to create those binaries yourself. The error you are getting is telling you that you don't have your machine configured to create binaries. I don't use Windows regularly enough to be able to help you with that, but someone else may be able to do so!

anthony-tuininga commented 3 years ago

cx_Oracle 8.1 has now been released which contains precompiled Python 3.9 binaries. Please try those!

codeape2 commented 3 years ago

I am stuck on Oracle client 10.2. Can cx-Oracle 5.2.1 be built on python 3.9?

anthony-tuininga commented 3 years ago

I sincerely doubt that combination is going to work for you. cx_Oracle 5.2.1 supports Python 3.5 so I'd use that version, if possible. Moving off Oracle Client 10.2 (which has not been supported for some time now!) is going to be your best move. Note that newer clients are capable of connecting to older databases, so you don't need to match client and database versions.

codeape2 commented 3 years ago

I built 5.2.1 with Python 3.7, that seems to work.

The Oracle DB I'm connecting to is pretty old, version 8.1.7. According to https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html : "Client-server version interoperability is detailed in Doc ID 207303.1". I do not have access to the referenced document (requires a Oracle account connected to a Oracle support agreement I believe).

But I got hold of a screenshot of a client/server version interop matrix that I assume is from that document:

image

codeape2 commented 3 years ago

I tried building cx_Oracle 5.2.1 with Python 3.9 and instantclient 10.2, and it worked!

cjbj commented 3 years ago

Thanks for letting us know.