Modulenotfounderror: no module named prettytable [SOLVED]

Are you looking for the solution to this error: modulenotfounderror: no module named prettytable“? If yes, then continue to read on because in this article we are going to explain the different solutions that can be used to resolve the error.

The “modulenotfounderror: no module named prettytable” is an error message in Python that usually happens when there’s a missing module that is required to run a program in Python.

This article we’ll discuss what this error is all about, the reasons behind it, and of course, how to troubleshoot it effectively.

What is “modulenotfounderror: no module named prettytable” error?

ModuleNotFoundError: No module named 'prettytable'

The error message modulenotfounderror: no module named ‘prettytable‘ indicates that the module you are trying to import in your Python script is unable to be found by the Python interpreter. In addition to that, this error usually occurs when the module is not installed on your system.

There are various reasons why you encounter this error, and you will see them below.

What are the reasons why this error “modulenotfounderror: no module named prettytable” occurs?

Here are the common reasons why this error usually happens and needs to be solve because it interrupts running your code in Python and delays your work.

  • 1. The “prettytable” module is not installed
  • If the “prettytable” module is not installed in the Python environment. Definitely, Python interpreter is unable to find the required module which results in an error.
  • 2.Incorrect installation
  • If you already installed the “prettytable” module but didn’t follow the proper installation procedure or it is being corrupted you will encounter this error.
  • 3.Incompatible version
  • If you are using a different version of Python and the module you want to import is in a different version, an error will arise. The reason is that it is not compatible with the version of the “prettytable” module you are using.
  • 4. Virtual environment issue
  • When you install the module or the package globally and not in your virtual environment. Certainly, in this error modulenotfounderror: no module named prettytable occurs.
  • 5. Import incorrectly
  • If the “prettytable” module is not imported correctly in the Python environment. It will display an error, you should make sure that you are importing the correct spelling of the module.
  • 6. Conflicting modules
  • If you have installed multiple versions of “prettytable” module on your system, it may cause conflicts that result in an error.

How to fix “modulenotfounderror: no module named prettytable” error?

Time needed: 2 minutes

Here are the effective solutions to fix the modulenotfounderror: no module named ‘prettytable’ error message: Open a terminal or command prompt.

  1. Install the prettytable module

    if you haven’t install the module, you can install it using the following command:

    Python 2
    pip install prettytable

    Python 3
    pip3 install prettytable

    Jupyter Notebook
    !pip install prettytable

    sudo apt install prettytable

  2. Check installation

    To check if the module is installed, you use the following command:

    pip show prettytable


    pip3 show prettytable

  3. Check Python version

    To check if you are using the correct Python version you can use the following command:

    python –version

    You can use this command to check if you are using the correct prettytable module version:

    pip show prettytable

  4. Upgrade “prettytable ” module version

    If the module is not compatible with the Python version you are using, you can update it using the following command:

    pip install prettytable -U

  5. Reinstall the module

    When the solution above does not resolve the error you can use the following command:

    To uninstall:
    pip uninstall prettytable
    pip3 uninstall prettytable

    To reinstall:
    pip install prettytable
    pip3 install prettytable

  6. Check the import statement

    If the error still exists after reinstalling, you have to double-check the import statement. Ensure that you are importing the correct spelling of the module, and you should import it correctly.


This article discusses the different solutions for the modulenotfounderror: no module named prettytable” error message. By executing the solutions above, we can guarantee that these solutions will help you resolve the error.

In your case, you just have to identify what caused the error in your Python script. Hopefully, you will solve the error immediately using the solutions provided above.

We also have solutions if you encounter an error likemodulenotfounderror: no module named simple_salesforce“. You can also visit our website for additional information.

Thank you very much for reading until the end of this article. Just in case you have more questions or inquiries, feel free to comment.

Leave a Comment