Solving the ModuleNotFoundError: No module named ‘carla’ Error
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
The following error pops up
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
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.
Now run the Python script again.