Skip to content

DPI-1047 persists with Python 3.12 + Instant Client 21.x in Docker #539

@Fontebasso-JV

Description

@Fontebasso-JV

DPI-1047: Cannot locate 64-bit Oracle Client in Docker container with Instant Client 21.19

I am experiencing the same issue described in issue #243: when using oracledb.init_oracle_client(lib_dir=...) inside a Docker container, I get the error:

1. Versions

  • Oracle Database: legacy clients (various versions that do not accept Thick mode)
  • Oracle Instant Client: 21.19
  • Python: 3.12.9
  • python-oracledb: latest available (1.x)
  • OS: Debian Bookworm base image in Docker
  • Docker container: airflow 2.10.5 official

2. Type of issue

Error (not a crash or hang)

3. Error(s) or behavior

running:

python3 -c "import oracledb; oracledb.init_oracle_client(lib_dir='/opt/oracle/instantclient_21_19')"

Produces:

oracledb.exceptions.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "/opt/oracle/instantclient_21_19/libclntsh.so: cannot open shared object file: No such file or directory"

Even after:
• Setting LD_LIBRARY_PATH=/opt/oracle/instantclient_21_19:$LD_LIBRARY_PATH
• Installing libaio1 and libnsl-dev
• Running tests as root or airflow user inside the container
• Verifying with file that libclntsh.so.21.1 is ELF 64-bit

4. Does your application call init_oracle_client()?

import oracledb oracledb.init_oracle_client(lib_dir="/opt/oracle/instantclient_21_19")

5. Minimal Python script to reproduce

`import oracledb

Initialize Oracle client

oracledb.init_oracle_client(lib_dir="/opt/oracle/instantclient_21_19")

Test connection (replace with actual DSN)

conn = oracledb.connect(user="user", password="pass", dsn="host:1521/service")
cur = conn.cursor()
cur.execute("SELECT 1 FROM dual")
print(cur.fetchone())`

6. Additional notes

•	The issue appears specifically in Docker containers with Python >= 3.12.
•	Running ldd on libclntsh.so.21.1 returns “not a dynamic executable”.
•	Likely a compatibility problem with how python-oracledb finds libraries in some Docker environments.
•	Important: The databases being connected to do not accept Thick mode connections, so Thin mode is not an option for some legacy clients.
•	Observation: The same code runs successfully on Windows with the same Instant Client version without any issues. This seems to indicate the problem is specific to the Linux/Docker environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Client Library or DatabaseAn issue with Oracle Client library or Oracle Database

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions