close

[Solved] Import: No module named ‘exceptions’

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Import: No module named ‘exceptions’ 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 Import: No module named ‘exceptions’ Error Occurs?

Today I get the following error Import: No module named ‘exceptions’ in python.

How To Solve Import: No module named ‘exceptions’ Error ?

  1. How To Solve Import: No module named 'exceptions' Error ?

    To Solve Import: No module named 'exceptions' Error when you are going to import the python-docx module, you’ll need to run import docx, not import python-docx.

  2. Import: No module named 'exceptions'

    To Solve Import: No module named 'exceptions' Error when you are going to import the python-docx module, you’ll need to run import docx, not import python-docx.

Solution 1

If you are using python 3x don’t do pip install docx instead go for

pip install python-docx 

It is compatible with python 3.x

Solution 2

When want to use import docx, be sure to install python-docxnot docx.You can install the module by running pip install python-docx.

The installation name docx is for a different module However,

when you are going to import the python-docx module, you’ll need to run import docx, not import python-docx.

if still you want to use docx module then:

First of all, you will need to make sure that the docx module is installed. If not then simply run pip install docx. If it shows ‘*requirement already satisfied*’ then the solution is :

  1. Go to the library to find docx.py file, you’ll need to go to directory where you installed python then \Lib\site-packages\ and find docx.py file
  2. Open docx.py file in text editor and find this codefrom exceptions import PendingDeprecationWarning
  3. Replace the above code with
try:
    from exceptions import PendingDeprecationWarning
except ImportError:
    pass
  1. Save the file
  2. Now you can run import docx module in Python 3.x without any problem

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