How to fix ModuleNotFoundError: No module named 'picamera'

Problem:

You want to run a Python script using the Raspberry Pi camera but you see an error message like

Traceback (most recent call last):
  File "mycamera.py", line 2, in <module>
    import picamera
ModuleNotFoundError: No module named 'picamera'

Solution

You need to install the picamera Python module using pip:

pip install -U picamera

In case you see

sudo: pip: command not found

install pip using

sudo apt install -y python3-pip