How to fix “ImportError: No module named …” error in Python?

How to fix “ImportError: No module named …” error in Python?

1. Find the python installation location using the command where python in the command prompt. 

2. Navigate to the Scripts folder under the python installation folder

3. Use the below command 

pip install <module name>

For example, if I get an error that module Requests is missing, the command will be

pip install requests

Post success message. Go to <python directory>\Lib\site-packages and ensure that the installed package is created as a folder.



If module error comes even after installing the module, Check if any multiple python versions are installed in the server 

If multiple python versions are installed uninstall any one version and follow the same steps from starting.

                  New to ADSelfService Plus?

                    • Related Articles

                    • Python Troubleshooting steps

                      Here we are listing the troubleshooting steps for the python script to be executed 1. Check whether python is installed or not in the sever where SDP is installed 2. If it's installed check the version of python ( Preferable version should be above ...
                    • How to setup Python on the Server

                      This article explains how to set up the ServiceDesk plus server to run python scripts. 1. The first step is to install python on the application server and you can download it from here . Any version above 3.4.1 should work fine. Once you've ...
                    • Some errors related to Python when trying to run a script in SDP MSP

                      Case 1: We could see cases where users come across the below error when trying to execute scripts. This happens if the requests library is not imported.   In order to import the requests library in Python, follow the steps below: 1. Open cmd as admin ...
                    • How to setup Python on the Server

                      This article explains how to set up the ServiceDesk Plus MSP server to run python scripts. 1. The first step is to install python on the application server and you can download it from here. Any version above 3.4.1 should work fine. Start the setup ...
                    • Cannot run program "python" or Can't find a default python

                      Use case While trying to run a python script, this error can be found. It usually occurs when the python is not installed/set up properly. Solution Try specifying the complete path of the python.exe instead of py and then in the argument specify the ...