{"id":23392,"library":"carla","title":"CARLA Simulator Python API","description":"Python API for communicating with the CARLA server, an open-source autonomous driving simulator. Current version 0.9.16. Release cadence irregular, with major version jumps (0.10.0 available but breaking).","status":"active","version":"0.9.16","language":"python","source_language":"en","source_url":"https://github.com/carla-simulator/carla","tags":["simulation","autonomous-driving","self-driving","carla"],"install":[{"cmd":"pip install carla","lang":"bash","label":"PyPI install (Python client only)"}],"dependencies":[{"reason":"Commonly used with carla for arrays","package":"numpy","optional":true},{"reason":"Image processing from carla sensors","package":"Pillow","optional":true}],"imports":[{"note":"Old API (pre-0.9.6) used CarlaClient. Modern API uses carla.Client.","wrong":"from carla.client import CarlaClient","symbol":"Client","correct":"import carla; client = carla.Client('localhost', 2000)"},{"note":"World is not directly importable; obtained via Client.","wrong":"from carla import World","symbol":"World","correct":"import carla; world = client.get_world()"},{"note":"Vehicle objects are spawned from blueprints.","wrong":"from carla import Vehicle","symbol":"Vehicle","correct":"import carla; vehicle = blueprint.library.find('vehicle.*')"}],"quickstart":{"code":"import carla\nimport random\n\nclient = carla.Client('localhost', 2000)\nclient.set_timeout(10.0)\nworld = client.get_world()\nblueprint_library = world.get_blueprint_library()\nbp = random.choice(blueprint_library.filter('vehicle.*'))\ntransform = carla.Transform(carla.Location(x=50, y=50, z=10), carla.Rotation(yaw=180))\nvehicle = world.spawn_actor(bp, transform)\nprint(f'Spawned {vehicle.id}')\nvehicle.destroy()","lang":"python","description":"Connect to CARLA server, spawn a random vehicle, and clean up."},"warnings":[{"fix":"Ensure pip version matches server version (e.g., pip install carla==0.10.0 for server 0.10.0).","message":"CARLA 0.10.0 changed the underlying Unreal Engine from 4.26 to 5.5, breaking compatibility with older Python APIs. The carla pip package may not match the server version.","severity":"breaking","affected_versions":">=0.10.0"},{"fix":"Download the server from https://github.com/carla-simulator/carla/releases.","message":"The carla Python package on PyPI is only the client library; you must download the CARLA server binary separately from the GitHub releases.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace get_traffic_manager with get_trafficmanager.","message":"Function `client.get_traffic_manager()` returns TrafficManager that has deprecated methods; use `client.get_trafficmanager()` instead.","severity":"deprecated","affected_versions":">=0.9.9"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: pip install carla","cause":"CARLA Python client is not installed.","error":"ModuleNotFoundError: No module named 'carla'"},{"fix":"Start the CARLA simulator binary before running the script. Default port 2000.","cause":"CARLA server is not running or port is incorrect.","error":"RuntimeError: unable to connect to server at localhost:2000"},{"fix":"Use: import carla; client = carla.Client('localhost', 2000)","cause":"Outdated carla package or wrong import (e.g., from carla.client import Client).","error":"AttributeError: module 'carla' has no attribute 'Client'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}