Solving the ModuleNotFoundError: No module named ‘carla’ Error

Imtiaz Ul Hassan
2 min readFeb 10, 2022

CARLA is an awesome simulator for carrying out experiment related to Autonomous Driving. But its user often face the import Carla error when they try to run a Python Script using CARLA python API.

For example when i try to run the manual_control.py example located in

<Path To Carla directory>/PythonAPI/examples

using the terminal as follows

running the manual_control.py script using terminal

The following error pops up

Import carla Error

Now to solve this error we have to extract the egg files into our python site packages folder as follows.There are two egg files in the following folder for python2 and python3. <Path To Carla directory>/PythonAPI/carla/dist

Egg files for python2 and 3

Now extract one of the egg files as per your python version. I am using python3 so i will extract the carla-0.9.11-py3.7-linux-x86_64.egg. after extracting it open the extracted folder. It contains 2 folders as follows.

Now copy both folders and paste it into the following location.

<HOME>/.local/lib/python3.6/site-packages

The .local folder is hidden so don’t forget to turn on the hidden folder options if you can’t see it.

Copied both of the folder to site-Packages

Now run the Python script again.

Manual_control.py runs successfully

--

--