pythongeopynominatim

ModuleNotFoundError: No module named 'geopy.geocoders'; 'geopy' is not a package


I am using VS and I am trying to run geopy, I installed all the prerequisites and get this error "ModuleNotFoundError: No module named 'geopy.geocoders'; 'geopy' is not a package"

from geopy.geocoders import Nominatim

geolocator = Nominatim(user_agent="http")
location = geolocator.geocode("175 5th Avenue NYC")
print(location.address)
print((location.latitude, location.longitude))
print(location.raw)

What am I missing?


Solution

  • I suspect the problem lies in you installing the geopy package in wrong version of python (The one that comes pre-installed in \AppData\Local\Microsoft\WindowsApps\python.exe is not full install). Grab a version of python (Either anaconda or vanilla python from python website). Let it install in default location, and then point VS code version of python that comes pre-installed with windows. Install geopypackage thorugh pip install geopy, either with VS, or through cmd with conda or pip. This should fix your problem.