oracle / python-oracledb

Python driver for Oracle Database conforming to the Python DB API 2.0 specification. This is the renamed, new major release of cx_Oracle
https://oracle.github.io/python-oracledb
Other
308 stars 61 forks source link

Support of native ARM thick client #195

Closed staticdev closed 1 year ago

staticdev commented 1 year ago

I see here that some people are able to run python-oracle thin client and using Rosetta. But Oracle provides ARM https://www.oracle.com/database/technologies/instant-client/linux-arm-aarch64-downloads.html

In some cases we need to use thick client and using Rosetta is really a hassle since instalation of whole virtualenv and tooling needs to be emulated to x86_64.

When I install ARM with recommended instations, python-oracledb still errors saying it cannot find DYLIB files, despite the fact the ARM client uses SO libs. Is it possible to enable that?

cjbj commented 1 year ago

If I understand correctly, the library loading in ODPI-C would need to change.

I don't want to put such a 'hack' into a released driver, because Linux ARM Instant Client hasn't been run through all Oracle DB regressions on macOS, so promoting it as a solution can set wrong expectations.

You can try building from source after changing lines like https://github.com/oracle/odpi/blob/v4.6.1/src/dpiOci.c#L490.

Let us know how it goes.

cjbj commented 1 year ago

I tried the ODPI-C hack with ARM Linux Instant Client and got the error:

DPI-1047: Cannot locate a 64-bit Oracle Client library: "dlopen(/Users/cjones/j/instantclient_19_10/libclntsh.so, 0x0001): tried: '/Users/cjones/j/instantclient_19_10/libclntsh.so' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OS/Users/cjones/j/instantclient_19_10/libclntsh.so' (no such file), '/Users/cjones/j/instantclient_19_10/libclntsh.so' (not a mach-o file), '/Users/cjones/j/instantclient_19_10/libclntsh.so.19.1' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OS/Users/cjones/j/instantclient_19_10/libclntsh.so.19.1' (no such file), '/Users/cjones/j/instantclient_19_10/libclntsh.so.19.1' (not a mach-o file)".

ntpbnh15 commented 1 year ago

When I install ARM with recommended instations, python-oracledb still errors saying it cannot find DYLIB files, despite the fact the ARM client uses SO libs. Is it possible to enable that?

Doesn't macOS on arm64 still use dylib (Darwin) and not so (Linux)? The Linux arm64 Instant Client package is just for Linux meaning those so files you see are not meant to be run nor linked against on macOS anyways. So, changing the library loading in the odpi library wouldn't help because Oracle hasn't released a macOs-on-arm64-compatible libclntsh.dylib.

I'm also interested in a native Oracle Instant Client for macOS-on-arm64. Using the thin client is not performant enough and some development workflows are simply not suited for Docker. Might I gently ask if a native macOS-on-arm64 build of the Instant Client is on Oracle's roadmap and can we get a rough ETA for it?

cjbj commented 1 year ago

Maybe @staticdev can explain whether he had a different idea.

@trphuongnam15 A macOS Silicon Instant Client is on the roadmap but I have no ETA. Can you open a new issue/discussion about your thin/thick performance differences and expectations so we can evaluate what we can improve?

staticdev commented 1 year ago

When I install ARM with recommended instations, python-oracledb still errors saying it cannot find DYLIB files, despite the fact the ARM client uses SO libs. Is it possible to enable that?

Doesn't macOS on arm64 still use dylib (Darwin) and not so (Linux)? The Linux arm64 Instant Client package is just for Linux meaning those so files you see are not meant to be run nor linked against on macOS anyways. So, changing the library loading in the odpi library wouldn't help because Oracle hasn't released a macOs-on-arm64-compatible libclntsh.dylib.

I'm also interested in a native Oracle Instant Client for macOS-on-arm64. Using the thin client is not performant enough and some development workflows are simply not suited for Docker. Might I gently ask if a native macOS-on-arm64 build of the Instant Client is on Oracle's roadmap and can we get a rough ETA for it?

Yes, it was my mistake. I unpacked Linux client. After that I discovered ARM/Mac doesn't really exist. My current idea is to invest on running Linux as client as a container and also remove interpreter for IDEs so that I can develop, apply migrations and run applications that need thick client. Still I am not successful with that and will need a bit more time to experiment. Running Rosetta for everything is a nightmare, was my first try but as long as your IDE or interpreter or any binary needs to interact with emulated Oracle client, chances are you also need to emulate it.

Best case is that Oracle will give a sign that they care and release something for ARM/Mac in the following months/year.

cjbj commented 1 year ago

FWIW, ARM Linux Instant Client 19.19 was just released. I don't have anything to add about macOS Silicon Instant Client. As a mac user, I'm waiting just like you.

staticdev commented 1 year ago

@cjbj i ended up making Intel mac instantclient work with rosetta. Not super happy but at least not stuck.

cjbj commented 1 year ago

Thanks for the info. Since the question is outside the scope of this repo, I'll close the issue.

cjbj commented 1 week ago

Oracle Instant Client 23.3 for macOS ARM has just been released: https://www.oracle.com/database/technologies/instant-client/macos-arm64-downloads.html