{"id":27312,"library":"python-geoip","title":"python-geoip","description":"Provides GeoIP functionality for Python. Version 1.2 is the last release, unmaintained since 2011. It wraps the MaxMind GeoIP legacy C library. Use python-geoip-geolite2 or geoip2 for modern MaxMind databases.","status":"deprecated","version":"1.2","language":"python","source_language":"en","source_url":"http://github.com/mitsuhiko/python-geoip","tags":["geoip","geolocation","legacy","deprecated"],"install":[{"cmd":"pip install python-geoip","lang":"bash","label":"Install last release"}],"dependencies":[{"reason":"Core dependency for database lookup","package":"GeoIP (C library)","optional":false},{"reason":"Alternative for GeoLite2 databases (no C library needed)","package":"python-geoip-geolite2","optional":true}],"imports":[{"note":"GeoIP class was removed; geolite2 provides lookup functions.","wrong":"from geoip import GeoIP","symbol":"GeoIP","correct":"from geoip import geolite2"},{"note":"geolite2 is a submodule of geoip, not a top-level package.","wrong":"import geolite2","symbol":"geolite2","correct":"from geoip import geolite2"}],"quickstart":{"code":"from geoip import geolite2\nmatch = geolite2.lookup('8.8.8.8')\nif match:\n    print(match.country)\n    print(match.continent)\n    print(match.timezone)\nelse:\n    print('No match')","lang":"python","description":"Look up IP address using GeoLite2 database (requires python-geoip-geolite2)."},"warnings":[{"fix":"Use python-geoip-geolite2 or geoip2 library.","message":"python-geoip 1.2 is unmaintained; uses legacy GeoIP databases. GeoLite2 databases will not work.","severity":"deprecated","affected_versions":"1.2"},{"fix":"Import geolite2: from geoip import geolite2","message":"The GeoIP class and the 'from geoip import GeoIP' pattern no longer exist in newer versions.","severity":"breaking","affected_versions":">=1.3 (if ever released) or when using python-geoip-geolite2"},{"fix":"Install libgeoip-dev and download GeoIP.dat from MaxMind legacy site.","message":"Requires separate GeoIP C library and database files. Database file path must be set via environment variable or manually.","severity":"gotcha","affected_versions":"1.2"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"pip install python-geoip or use python-geoip-geolite2.","cause":"python-geoip not installed or imported incorrectly.","error":"ModuleNotFoundError: No module named 'geoip'"},{"fix":"pip install python-geoip-geolite2","cause":"python-geoip-geolite2 not installed; only base python-geoip is installed.","error":"AttributeError: module 'geoip' has no attribute 'geolite2'"},{"fix":"Call geolite2.lookup('8.8.8.8') with an IP string.","cause":"Using geolite2.lookup incorrectly (e.g., geolite2.lookup()).","error":"TypeError: lookup() missing 1 required positional argument: 'ip'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}