Modulenotfounderror: no module named ‘cx_oracle’ [Fixed]

In this article, we will show to solve Modulenotfounderror: no module named cx_oracle.

Along with we will look into the causes of this error as well as understand this error.

Modulenotfounderror: no module named ‘cx_oracle’

The Modulenotfounderror: no module named cx_oracle is occur when we cannot find the module cx_oracle every time we import or used it in our set of code.

Particularly when the cx_oracle module is not installed with the pip install cx_oracle.

In addition to this if we have a different version of python on your system and the cx_oracle is not installed in that particular version.

ModuleNotFoundError No module named 'cx_Oracle'
ModuleNotFoundError No module named ‘cx_Oracle’

In the figure above for instance we try to import cx_oracle, unfortunately, throws an error Modulenotfounderror: no module named ‘cx_oracle’.

How tp solve Modulenotfounderror: no module named ‘cx_oracle’

Here are some solutions to solve Modulenotfounderror: no module named ‘cx_oracle’.

  1. Installed the module

    The first step to remove this error is to install cx_oracle module on your system.

    So before we can able to import it into our script we will install it first using the following command.

    pip install cx_oracle

    install cx_oracle

    However, if the module is already installed, you might need to update it to the latest version using the following command:

    pip install –upgrade pyserial

    update cx_oracle

  2. Fix the path

    If you have already installed the module but still getting the error.

    It could be because the module is installed but on the wrong path.

    To fix this follow this guide:
    1. Open the command prompt and type where python.

    2. When python folder opened, head over to the script folder and copy its location. Make sure it has pip file.

    3. In the command prompt type cd command and paste the copied location.

    4. Now now install the module using this pip install cx_oracle command.

  3. Import the module

    Once the module is installed, try to import it and see if the error still persists.

    To do this try to run this command:

    import cx_Oracle

    import cx_oracle

    If the error still shows, make sure to double-check the module name in your code, to match the module you have installed.

  4. Check python version

    Now that you confirmed that the module is installed and the module named is correct, but still getting the modulenotfounderror.

    Then it could be the incompatibility of Python version.

    Therefore check the serial module documentation and ensure that it is compatible with your python version.

    However if not, you need to upgrade to a new version of Python that is compatible with the module.

    To check your python version, use the following command:

    python —version

    python version

Causes Modulenotfounderror: no module named ‘cx_oracle’

As mentioned above the ModuleNotFoundError: No module named ‘cx_Oracle’ error occurs when Python cannot find the cx_Oracle library.

There are several reasons why this may happen, such as:

  • Missing installation of the library: If cx_Oracle is not installed, Python cannot find the library and will generate an error.
  • Incorrect library version: If the version of cx_Oracle installed is not compatible with the version of Python, the library may not work correctly, leading to an error.
  • Other possible reasons: Other reasons for the error may include a corrupt installation, incorrect system configuration, or incorrect import statement.


Facing the “ModuleNotFoundError: No module named ‘cx_oracle'” error message can be frustrating, but it is a common issue that can be resolved with a few simple steps.

Ensuring that the “cx_oracle” module is installed, double-checking the module name in your system, will resolve the error.

We hope you’ve learned a lot from this.

Thank you for reading.

Leave a Comment