Anaconda 3.5 (64-bit Windows) Install cx_Oracle

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

I tried using anaconda:

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

The following are error messages:

 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 

Cx_oracle does not seem to be compatible with Python 3.5.

After that, I also tried installing directly with binary:

 python setup.py install 

It produces a bunch of errors, such as:

 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 ??

+8
python oracle anaconda cx-oracle
source share
2 answers

This is kind of nontrivial. However doable. Follow these steps:

1) Download the Oracle Instant Client for Windows x64 from

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

eg. choose a client, for example. 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 a directory and unzip the client and sdk:

eg. C: \ op \ 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

eg. ORACLE_HOME = C: \ ora \ 11gx64

and TNS_ADMIN = c: \ ora \ 11gx64

also add% ORACLE_HOME% to your% PATH%

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

% 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 SID

5) Suppose you already have Python installed.

-> Otherwise, visit the download page for Python

-> Install python (3.6.1 at time of writing)

-> If install pip is not installed ( 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

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

7) Use pip to install cx_oracle

  pip install cx_oracle 

(during recording, there is a problem with the default version 5.3 installed, so you need to install version 6.0b2)

  python -m pip install cx_Oracle --pre 

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

+1
source share

I could not install cx_oracle from pip3 or conda. Got this eventually by downloading the installer for Windows 64 from pypi https://pypi.python.org/pypi/cx_Oracle/

0
source share

All Articles