I have a problem importing cx_Oracle with Python. I know a lot of issues with cx_Oracle have been discussed here, but it seems that I cannot find a solution to my problem after reading all the related topics.
I have two machines, one is my computer and another one is a remote workstation, which have similar configs (Windows 7, 64-bits). I need to install cx_Oracle on the remote workstation but it does not work, whereas it works fine on my computer (I can import the module successfully and connect to my DB). On the remote workstation, I have the following error :
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import cx_Oracle
ImportError: DLL load failed: The specified module could not be found.
I have double-checked my environment variables, and I re-installed cx_Oracle a couple of times, but I cannot get it working... I did some research about this problem and I am kind of stuck here, I do not understand why it is working fine on my computer but not on this remote workstation (the only difference is that this remote workstation is a VM).
Does anyone have an idea on what could be the issue?
Running Dependancy Walker on both cx_oracle.pyd (on my computer where it works fine and on the remote workstation where cx_oracle does not work), the only difference are the dll MSVCR100 amd MSVCR90 which are not found on my remote workstation.
I have the following environment variables setup:
C:\Oracle as ORACLE_BASE
C:\Oracle\instantclient_12_1
as ORACLE_HOMEC:\Oracle\instantclient_12_1
added to the "Path" variable
Both machines are 64-bit, Windows 7
I am running Python 2.7.5
I unzipped instantclient-basic-nt-12.1.0.1.0 in C:\Oracle\instantclient_12_1
I installed cx_Oracle-5.1.2-11g.win32-py2.7s
On the remote workstation, sys.path
gives me :
'C:\Python27\Lib\idlelib', 'C:\Windows\system32\python27.zip', 'C:\Python27\DLLs', 'C:\Python27\lib', 'C:\Python27\lib\plat-win', 'C:\Python27\lib\lib-tk', 'C:\Python27', 'C:\Python27\lib\site-packages'
EDIT 1
In the previous post, all files (Python 2.7, cx_Oracle package, Oracle Instant client) were for 32 bit systems. I downloaded the same version of those files for 64 bit systems and everything is working fine on my remote workstation now.
EDIT 2
Basically, the fix consisted for me in re-installing everything (Python, Oracle Instant Client and cx_Oracle) for 64-bit systems instead of 32-bit systems.
To summarize, this was my problem and how it got fixed: 1) I installed Cx_Oracle (from 32-bit windows installation package) and Oracle Instant Client (32-bit) and it was working perfectly on my 64-bit system running python 2.7.5 for 32-bit systems 2) I did the same thing exactly on a Virtual Machine (running a 64-bit system as well) and it was not working 3) To get it working on the VM, I re-installed everything for 64-bit systems (python, Instant Client, Cx_Oracle) and it finally worked
http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html http://sourceforge.net/projects/cx-oracle/files/5.1.2/
Also, Make sure to download the cx_Oracle and Instant client corresponding to your DB version (11g in my case). Hope this helps.