cannot import name GoogleMaps in python

googlemaps python documentation
google maps api key python
gmaps address_to_latlng
googlemaps python sdk
google maps python github
google geocoding api python
free map api python

I am using the code below to get the latitude & longitude of an address:

from googlemaps import GoogleMaps
gmaps = GoogleMaps(api_key)
address = 'Constitution Ave NW & 10th St NW, Washington, DC'
lat, lng = gmaps.address_to_latlng(address)
print lat, lng

but am getting the error below

File "C:/Users/Pavan/PycharmProjects/MGCW/", line 1, in <module>
    from googlemaps import GoogleMaps
ImportError: cannot import name GoogleMaps

I have seen another question similar to this, but the solution didn't work for me.

Use geopy instead, no need for api-key.

From their example:

from geopy.geocoders import Nominatim
geolocator = Nominatim()
location = geolocator.geocode("175 5th Avenue NYC")
print((location.latitude, location.longitude))


Flatiron Building, 175, 5th Avenue, Flatiron, New York, NYC, New York, 10010,  United States of America
(40.7410861, -73.9896297241625)

cannot import name GoogleMaps, to install google maps. but when I tried to import the GoogleMaps class, it failed although googlemaps is installed. Python 2.7. $ pip install -U googlemaps Note that you will need requests 2.4.0 or higher if you want to specify connect/read timeouts. Usage. This example uses the Geocoding API and the Directions API with an API key: import googlemaps from datetime import datetime gmaps = googlemaps.

I think what you are looking for is the Client class not GoogleMaps.

If you want to call it GoogleMaps import it as follows:

from googlemaps import Client as GoogleMaps

installing GoogleMaps module in python, It looks like you have a python file called ? This is causing a circular import and is repeatedly trying to import GoogleMaps from itself. Python Client for Google Maps Services. Description. Use Python? Want to geocode something? Looking for directions? Maybe matrices of directions? This library brings the Google Maps Platform Web Services to your Python application. The Python Client for Google Maps Services is a Python Client library for the following Google Maps APIs

Another option is parsing the json from Example:

import requests, json

url = ''
addresses = ['175 5th Avenue NYC', 'Constitution Ave NW & 10th St NW, Washington, DC']

for address in addresses:
    resp = requests.get(url=url+address)
    data = json.loads(resp.text)
    print data['features'][0]['geometry']['coordinates']


[-76.1438449, 40.229888]
[-77.046567, 38.8924587]

These are given in lon, lat. The second one is a bit off by about 1 mile. Seems street intersections are difficult.

ImportError: cannot import name , (/usr/local/lib/python3.7/site-packages/googlemaps/ Info: python ImportError: cannot import name 'places_autocomplete_session_token' from  Usage. Just import API endpoint of your choice and start querying: from gmaps import Geocoding api = Geocoding api. geocode ("somwhere") api. reverse (51.123, 21.123). If you need to use Google Maps API for Business then instantiate your endpoint with api_key param

I could write a code for multiple address but it never worked.. Finally found this website which could generate geocodes in bulk.. I think it may be useful to someone looking for bulk geocodes.. It also has reverse geocoding..

googlemaps/google-maps-services-python: Python client , Usage. This example uses the Geocoding API and the Directions API with an API key: import googlemaps from datetime  to install google maps. but when I tried to import the GoogleMaps class, it failed although googlemaps is installed. Python 2.7.6 (default, Mar 22 2014, 22:59:38) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import googlemaps >>> >>> from googlemaps import GoogleMaps Traceback (most recent

python-gmaps · PyPI, Google Maps API client. To name a few: * googlemaps * google.directions. What's wrong from gmaps import Geocoding api = Geocoding()  To get this to work without having to parse a JSON string, we can leverage the googlemaps package. If not already installed, run pip install googlemaps to get it going, then import it into your environment.

flask-googlemaps · PyPI, from flask import Flask from flask_googlemaps import GoogleMaps app = Flask(​__name__) # you can set key as config app.config['GOOGLEMAPS_KEY']  ImportError: cannot import name string_int_label_map_pb2. after running protoc object_detection\protos\string_int_label_map.proto make sure file is created in object_detection\protos directory. I had the same problem.

python - cannot import name GoogleMaps -, pip install googlemaps. to install google maps. when tried import googlemaps class, failed although googlemaps installed. python 2.7.6 (default  name (string or list of strings) – One or more terms to be matched against the names of places. open_now ( bool ) – Return only those places that are open for business at the time the query is sent.

python - no puede importar GoogleMaps nombre, Tal vez la documentación es un poco anticuado: Client utilizar en lugar de GoogleMaps >>> from googlemaps import Client >>> dir(Client) ['__class__',  Python Geocoding Toolbox. geopy is a Python client for several popular geocoding web services. geopy makes it easy for Python developers to locate the coordinates of addresses, cities, countries, and landmarks across the globe using third-party geocoders and other data sources.

  • this code is working fine for single location & when am passing multiple locations am getting all latitudes & longitudes same..
  • this seems to work now.. anyhow I need to locate 44,000 locations.. will try to put them in a file & will pass them..
  • @PavanChakravarthy I'm not too familiar with the library but they do seem to have nice documentation
  • as expected the above code worked fine for few locations & if it couldnt find the coordinates it would fail other locations also..
  • @PavanChakravarthy Yes geopy seems to not be able to handle some types of addresses. Check out my other answer using
  • did that & now am getting this error File "C:/Users/Pavan/PycharmProjects/MGCW/", line 2, in <module> gmaps = GoogleMaps(api_key) NameError: name 'api_key' is not defined
  • @PavanChakravarthy that's because you need an api. Use geopy instead.
  • Did you define the name api_key? It seems that you didn't.
  • Check this out for a description of the API key:
  • Your answer is not true. The problem is from the package, not the installation!