close

[Solved] Python: import cx_Oracle ImportError: No module named cx_Oracle error is thown

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Python: import cx_Oracle ImportError: No module named cx_Oracle error is thown in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Python: import cx_Oracle ImportError: No module named cx_Oracle error is thown Error Occurs?

Today I get the following error Python: import cx_Oracle ImportError: No module named cx_Oracle error is thown in python.

How To Solve Python: import cx_Oracle ImportError: No module named cx_Oracle error is thown Error ?

  1. How To Solve Python: import cx_Oracle ImportError: No module named cx_Oracle error is thown Error ?

    To Solve Python: import cx_Oracle ImportError: No module named cx_Oracle error is thown Error Tried installing it via rpm posted in above answers, but it didn't worked. What worked instead is plain pip install.

  2. Python: import cx_Oracle ImportError: No module named cx_Oracle error is thown

    To Solve Python: import cx_Oracle ImportError: No module named cx_Oracle error is thown Error Tried installing it via rpm posted in above answers, but it didn't worked. What worked instead is plain pip install.

Solution 1

Tried installing it via rpm posted in above answers, but it didn’t worked. What worked instead is plain pip install.

pip install cx_oracle

The above command installed cx_oracle=6.1 Please note that I’m using python 2.7.14 Anaconda release and oracle 12c.

Solution 2

Windows and Anaconda help

Anaconda 4.3.0 comes with Python 3.6 as the root. Currently cx_Oracle only supports up to 3.5. I tried creating 3.5 environment in envs, but when running cx_Oracle-5.2.1-11g.win-amd64-py3.5.exe it installs in root only against 3.6

Only workaround I could find was to change the root environment from 3.6 to 3.5:

activate root
conda update --all python=3.5

When that completes run cx_Oracle-5.2.1-11g.win-amd64-py3.5.exe.

Tested it with import and worked fine.

import CX_Oracle

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read