Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I instal cx_Oracle package to Anaconda 3 to use with python 3.5

I need to connect to Oracle database in Python Anaconda3-2.5.0-Windows-x86_64. Installation of the cx_Oracle module by:

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

fails with following output (trimmed):

Hint: the following packages conflict with each other:
  - cx_oracle
  - python 3.5*

So I tried to install package for Python 3.5 by 'cx_Oracle-5.2.1-11g.win-amd64-py3.5.exe' from https://pypi.python.org/pypi/cx_Oracle/ Which seems to be working (somehow). Even 'conda list' command prints line:

cx-oracle                 5.2.1                     <pip>

But when I enter import cx_Oracle; in Python then

ImportError: DLL load failed: Uvedený modul nebyl nalezen.

appears. Rough translation of last localized part is 'Modul not found.'

How can I install the cx_Oracle module? Or is there any other way to connect to Oracle database?

like image 979
plastique Avatar asked Feb 19 '16 13:02

plastique


People also ask

What is import cx_Oracle?

cx_Oracle is a Python extension module that enables access to Oracle Database. It conforms to the Python database API 2.0 specification with a considerable number of additions and a couple of exclusions. cx_Oracle 8.3 was tested with Python versions 3.6 through 3.10.

Does cx_Oracle require Oracle client?

Using cx_Oracle requires Oracle Client libraries to be installed. These provide the necessary network connectivity allowing cx_Oracle to access an Oracle Database instance. Oracle Client versions 19, 18, 12 and 11.2 are supported.


1 Answers

I'm assuming that you have windows and python 3.5 only installed. Check your anaconda just incase to make sure you are using anaconda3 or that anaconda is setup with python3 environment. Assuming all that checks out and you are still getting that same error try doing a fresh install of cx_oracle from pip.

On your windows machine open up cmd and type pip install cx_Oracle and it should install nicely. If you by chance have python2 installed as well you might want to do python3 -m pip install cx_Oracle. After installation completes you should be good to go.

like image 176
Seekheart Avatar answered Nov 15 '22 00:11

Seekheart