Here's what I did:
instantclient-basic-nt-11.2.0.3.0.zip
, unzipped it, and put it in C:\\Program Files\\Oracle\\instantclient_11_2
.Path
environment variable.ORACLE_HOME
holding this path as its value.cx_Oracle-5.1.2-11g.win32-py2.7.msi
. And on running import cx_Oracle
all I get is
Traceback (most recent call last):
File "<string>", line 2, in <module>
ImportError: DLL load failed: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
I obviously uninstalled / reinstalled cx_Oracle a couple of times but really nothing seems to help. Could anyone please provide a clue how to fix this?
UPDATE
I ran Dependency Walker and it comes up with a lot of trouble. However, the first missing .dll (msvcr80.dll) is actually present in C:\\WINDOWS\\WinSxS\\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.91_x-ww_0de56c07
.
OK, what finally solved the problem (not sure whether all steps are necessary and no idea why exactly this and only this worked so far):
To help other people with the same problem:
This error tells about 32-64 bit mismatch between some DLL while importing module. Possibilities are:
Keep in mind that cx_Oracle uses standart Oracle client (at OCI level), which must be installed on your machine. It searches for oci.dll in several places, including PATH . If it finds oci.dll of wrong version of the client, the error appears.
In case you get this error, check path list in the PATH environment variable. It is likely to contain path to BIN folder of wrong version of Oracle client. If you have several clients, specify in the PATH the appropriate one, or install the appropriate client.
NOTE: ORACLE_HOME does not have an effect for cx_Oracle. In my case only changing of PATH helped. I think the Ruben's solution works because of item 3 ('Add this same path to the "Path" environment variable').
I am using python35 64 bit and oracle express on win 7 (64 bit). I installed cx_Oracle using pip3 ( pip3 install cx_Oracle
) instead of downloading the installer from pypi.
I faced the same problem.
I solved it by following above guidelines, but instead of 32 bit client, I downloaded the 64 bit version of the instant client (instantclient-basic-windows.x64-11.2.0.4.0.zip) fromhttp://www.oracle.com/technetwork/topics/winx64soft-089540.html .
I then extracted it to c:\\oraclexe. And added these environment variables
set ORACLE_BASE=C:\oraclexe
set ORACLE_HOME=C:\oraclexe\app\oracle\product\11.2.0\server
set PATH=C:\oraclexe\instantclient_11_2;%PATH%
And ran my django migrate commands:
python manage.py migrate
It worked excellent
Easy way:
cx_Oracle-5.1.3-11g.win32-py2.7.exe
instantclient_12_1
and move it to C:\\Python27
C:\\Python27\\instantclient_12_1
Same ImportError
occured for setup of:
I solved it copying msvcr100.dll
file into <oracle_instant_client_dir>
Had this issue also, and it seems importing cx_Oracle (at least as of 5.1.2) will fail (with the same error) if you have any invalid/unreachable UNC paths in front of Oracle in the PATH environment variable.
Fixing the UNC path (which was unrelated to Oracle) resolved the problem.
If you're using conda as a package manager, one way to overcome the DLL issue it to install oracle-instantclient by doing a conda install oracle-instantclient
. This fixed the dependency which I couldn't fix by manually installing Oracle's instant-client.
As is the second time I came to this question, I feel the need to post what I did:
I'm using:
I had no success installing Python and cx_Oracle 64 bits .
It only worked when I tried 32 bits versions and followed @rob answer instructions
I had same issue with DLL load failed on my Windows machine. installed oracle client, set variables, ran cx_Oracle-5.1.3-11g.win32-py2.7.exe file.
however when I installed cx_Oracle with easy_setup it fixed the problem.
C:\Python27\Scripts\easy_install.exe cx_Oracle-5.1.3-11g.win32-py2.7.exe
Steps I have followed :
Downloaded the smart client instantclient-basic-windows.x64-12.1.0.2.0.zip
Extracted and copied to #your directory#\\instantclient_12_1
Above directory contains dll's
Append the PATH variable with #your directory#\\instantclient_12_1 and created env variable ORACLE_HOME= #your directory#\\instantclient_12_1
Download and install cx_Oracle-5.2.1-11g.win-amd64-py2.7.exe
Open idle type import cx_Oracle
if you're using Anaconda on Windows try:
conda install cx_oracle
on your cmd
-> this
I know this is an old post, but I had this problem today and none of the solutions worked. I figure this could work for others with the same problem as of now.
Python version : 2.7.15 (64 bits) cx_Oracle version : 6.4.1 Oracle Instant Client : 18.3
I kept getting the following error even though I followed evry steps in the correct order :
cx_Oracle.DatabaseError: DPI-1047: Oracle Client library cannot be loaded
I solved it by downgrading my Oracle Instant Client version to 12.1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.