Error: ModuleNotFoundError: No module named ‘pymongo’

Facing Error: ModuleNotFoundError: No module named ‘pymongo’

i tried installing pip pymongo, but it say source already exists, so i tried updating and updated.
i have upated the package and message is below:
C:\Windows\system32>pip install pymongo
Requirement already satisfied: pymongo in c:\program files (x86)\python39-32\lib\site-packages (4.4.0)
Requirement already satisfied: dnspython<3.0.0,>=1.16.0 in c:\program files (x86)\python39-32\lib\site-packages (from pymongo) (2.4.2)

but still the error is same… can some help on it



This implies that the module pymongo was downloaded to your Python v3.9 package. What Python version are you currently running on?

On the Python editor, type the following to get your active Python version:

import sys

major, minor, micro = sys.version_info[:3]
print(f"Your Python version is {major}.{minor}.{micro}")

Does it match v3.9? If not, that means that you have more than one version of Python on your system.

checking now

it is showing as 3.9.6

should i do something now to get issue fixed.

It may be that the module pymongo namespace is not included in your active search path of the Python IDE that you are using.

What is the Python IDE that you are currently using?

currently i am using VS to write the python script

The following instructions give you the active path directory where Python searches for modules.
Does the path directory include the location where the pymongo was downloaded to?

import sys

num = 1
for path in sys.path:
    print(str(num) + '.' + str(path))
    num += 1

Are you using the pip from the Python interpreter you want to use?

With the Python interpreter you want to use to run the code that imports pymongo, you could try this: path\to\python.exe -m pip show pymongo.


Do you understand what a virtual environment is?

Have you checked the documentation and your project config, to see whether your IDE is using and managing a virtual environment for the code? If it is, you should use the IDE’s tools to install packages into that virtual environment.

Are you sure it’s Visual Studio, and not Visual Studio Code (completely different product, much more commonly used for languages that aren’t C, C++ or C#)?

my Typo mistake, its VSC

@sinoroc - would it be the same syntax, if i want to check from visual studio code?

I have no idea.