Anaconda 3.5 (64bit Windows) Install cx_Oracle
Asked Answered
C

2

8

I have installed Anaconda 3.5 for Windows 64bits, and I need to connect to the Oracle database using package "cx_Oracle".

I tried with the anaconda way:

conda install -c https://conda.anaconda.org/anaconda cx_oracle

The error messages below:

Hint: the following packages conflict with each other:
  - cx_oracle
  - python 3.5*
Use 'conda info cx_oracle' etc. to see the dependencies for each package.
Note that the following features are enabled:
  - vc14

It seems that cx_oracle isn't compatible with Python 3.5.

After this, I also tried to install directly with the binary:

python setup.py install

It throws a bunch of errors like:

cx_Oracle.obj : error LNK2001: unresolved external symbol OCILobGetChunkSize
cx_Oracle.obj : error LNK2001: unresolved external symbol OCIStmtExecute
cx_Oracle.obj : error LNK2001: unresolved external symbol OCILobFileClose

Is there a way to install cx_oracle for Anaconda 3.5 ??

Cecelia answered 6/1, 2016 at 16:24 Comment(6)
Try to download and pip install cx_Oracle-5.2+oci12c-cp35-none-win_amd64.whl from lfd.uci.edu/~gohlke/pythonlibs/#cx_oracleResiniferous
Hi Gohlke, Thanks for your comment. I successfully installed it using the wheel file. However, when I try my script, it throws an error message below: Traceback (most recent call last): File "testDB.py", line 1, in <module> import cx_Oracle ImportError: DLL load failed: La procédure spécifiée est introuvable. (The specified procedure cannot be found.)Cecelia
In addition to my comment, I have installed oracle client 11.2.0.3, and the paths are in the system variable Path: C:\oracle\ora_client\bin C:\oracle\product\64bit\11.2.0.3.0\binCecelia
The binaries require Oracle version 12.1, not 11.2.Resiniferous
I tried this also: downloaded Oracle client 12.1, put the unziped folder in Anaconda folder, and added it into Path. But it still didn't work....Cecelia
Has anyone solved this yet, similar issue with Anaconda 4.0.0 Python 3.5?Axes
F
1

It's kind of non-trivial. However doable. Follow these steps:

1) Download Oracle Instant client for Windows x64 from

http://www.oracle.com/technetwork/topics/winx64soft-089540.html

e.g. choose client e.g. 11.2.0.4

-> instantclient-basic-windows.x64-11.2.0.4.0.zip

-> instantclient-sdk-windows.x64-12.1.0.2.0.zip

2) Create directory and unzip the client & sdk in there:

e.g. c:\ora\11gx64

3) Set ORACLE_HOME and TNS_ADMIN

See https://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10 for details

e.g. ORACLE_HOME=c:\ora\11gx64

and TNS_ADMIN=c:\ora\11gx64

also add %ORACLE_HOME% in Your %PATH%

4) In the created directory put file tnsnames.ora and fill with connection string to db:

%ORACLE_HOME%**tnsnames.ora**

XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )

-> replace 127.0.0.1 with your hostname

-> replace XE with your SID

5) I suppose You've got already Python installed.

-> Otherwise visit Download page for Python

-> Install python (3.6.1 in the time of writting)

-> If not installed install pip (https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip)

-> execute python get-pip.py

6) Download and Install Visual C++ 2015 Build Tools

-> Search for Visual C++ 2015 Build Tools -> Install visualcppbuildtools_full.exe

7) Use pip to install cx_oracle

  pip install cx_oracle

(in the time of writing there is trouble with default installed version 5.3 so the Version 6.0b2 has to be installed)

  python -m pip install cx_Oracle --pre

The first steps are universal in my honest opinion for both conda and pip.

Fractionate answered 9/6, 2017 at 22:23 Comment(0)
S
0

I couldn't install cx_oracle from pip3 or conda either. Got it working eventually by downloading the installer for windows 64 from pypi https://pypi.python.org/pypi/cx_Oracle/

Svoboda answered 26/9, 2016 at 10:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.