Forums

How to use Python Client for Google Maps Services

Hi,

I am beginner and learning python, need help in using the Python client for Google Maps Services.

I have imported googlemaps using pip install --user googlemaps. pip3.5 install --user googlemaps failed with error.

The code works when i use #!/usr/bin/python2.7 and fails with ImportError: No module named 'googlemaps' if remove that statement from the first line beginning.

Please let me know how to import googlemaps when the interpreter is 3.5 or above.

I am able to import and use googlemaps on my desktop with Python 3.6 but not on Pythonanywhere, please let me know if i need to do any additional changes to make it work on pythonanywhere.

Was the error you got when you tried to install it using pip3.5 a VersionConflict error like this:

pkg_resources.VersionConflict: (urllib3 1.16 (/usr/local/lib/python3.5/dist-packages), Requirement.parse('urllib3<1.23,>=1.21.1'))

...? If so, it looks like it's an incompatibility between certain versions of pip and the googlemaps package.

The problem does not seem to happen with Python 3.6 on PythonAnywhere:

~ $ pip3.6 install --user googlemaps
Collecting googlemaps
Requirement already satisfied: requests<3.0,>=2.11.1 in /usr/local/lib/python3.6/dist-packages (from googlemaps)
Installing collected packages: googlemaps
Successfully installed googlemaps-2.5.1
~ $

...so if using Python 3.6 is an option for you, then that's probably the best way forward.