Installed geoip2 module via pip, but MS Code still won't recognize geoip2

Hi peeps, I’m hoping someone here can help, as I have scoured the internet and found nothing useful yet. I have some assignments coming up and some of the labs want me to to use geoip2, for geolocation mapping an IP address, etc…But Python, MS Visual Code just doesn’t recognize this at all. I’ve looked in docs.python.org and there’s nothing there either. Why would a tutor force me to use something that doesn’t exist? It doesn’t make sense. Maybe the syntax has changed since they last used it.
Can anyone help? I don’t need help in using it, the problem is that Python doesn’t recognize geoip2 or geolite. I have used pip to install the modules, but for whatever reason, MS Code has no idea what I am talking about.

Please help.

I’ve not used it, but is this not what you’re looking for?

Yeah that’s it, but MS Code doesn’t recognize it. When I use import geoip2.database or anything, it states that it cannot resolve geoip2. I’ve seen code grabs of people using it, but I don’t know how old those are, or what they did to get it to work for them. It just won’t recognize it, when I try to use it. Like I wrote, I have installed the module using pip, so it is there, but MS Visual Code just won’t recognize it.

Also, that looks like it’s being run from a Linux command line, whereas I am trying to do this on a Windows PC.

It’s unlikely, that you’re using a Python version that is not at the least v3.7, but it’s worth asking. Also, make sure that it’s not that your IDE is getting in the way somehow.

Bypass your IDE by simply opening a Python REPL in a terminal session. This will also confirm the Python version.

I’m not a Windows user, but that should not matter and I don’t know that what will work on a Linux system will not work on a Windows system, to a large extent, but there may be some corner cases.

This is the kind of output that you should be getting when you start a Python REPL session.

python3.8
Python 3.8.10 (default, May 26 2023, 14:05:08) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

… then enter import geoip2.webservice and see if you get an error message.

Third-party libraries, such as geoip2, need to be installed before they can be used. They are code that was written by someone else, and they do not come with Python. Some IDEs try to provide an interface to look up and install these libraries. I don’t know how MS Visual Code handles this.