0

I'm trying to use cx_Oracle in Python to connect to my database. I'm encountering the following error:

DPI-1047: 64-bit Oracle Client library cannot be loaded: "C:\oracle\product\V11.2.0.10\bin\oci.dll is not the correct architecture"

It looks to me like both Python and Oracle are 64-bit installs. Specs below:

Python 3.6.1 | Anaconda 4.4.0 (64-bit)

Oracle Database 11g Enterprise Edition Release 11.2.04.0 - 64bit Production

swysell
  • 107
  • 3
  • 8

1 Answers1

2

Download Sigcheck from Sysinternals and check the architecture:

c:\>sigcheck c:\oracle\product\12.1\Client_x64\bin\oci.dll

Sigcheck v2.60 - File version and signature viewer
Copyright (C) 2004-2017 Mark Russinovich
Sysinternals - www.sysinternals.com

c:\oracle\product\12.1\client_x64\bin\oci.dll:
        Verified:       Unsigned
        Link date:      09:49 11.09.2014
        Publisher:      n/a
        Company:        Oracle Corporation
        Description:    Oracle Call Interface
        Product:        n/a
        Prod version:   n/a
        File version:   12.1.0.0.0 Production
        MachineType:    64-bit

c:\>

Do the same with your Python binary.

Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
  • I couldn't get sigcheck to work, but I found another way and it does appear that the oci.dll is a 32-bit... So do I need to reinstall Python as 32-bit? – swysell Oct 26 '18 at 17:19
  • 2
    Either install 32-Bit Python or 64-Bit Oracle Client. In general it does not matter as long as Phyton and Oracle are the same architecture. You can also install 32-Bit and 64-Bit Oracle client on one machine, follow this instruction: https://stackoverflow.com/questions/24104210/badimageformatexception-this-will-occur-when-running-in-64-bit-mode-with-the-32#24120100 I think, based on the same principle it should be also possible to install 32-bit and 64-bit Python on the same machine. – Wernfried Domscheit Oct 26 '18 at 20:25