If you are running kernel from a Conda environment, in the terminal you should first select the correct environment:
conda activate name_of_environment pip3 install pydub