pythongtts

error while installing gtts (import gTTS) google text to speech library


I am getting this error when importing gtts module. I have successfully installed gtts but its is giving :: "ModuleNotFoundError: No module named 'certifi'"

I have also installed certifi using "pip install certifi".

enter image description here


Solution

  • Okay, So this error says "certifi" Module is not found. There can be many reasons for this but for your problem it seems like where you have installed certifi and from where you are accessing it( jupyter notebook) both location are different. So if you are on windows just run powershell or command prompt and run: python when the python shell appears do:

    import sys
    print(sys.executable)
    

    Note the path, Now open up your Jupyter notebook and do the same:

    import sys
    print(sys.executable)
    

    if both the paths are not same that means you have been installing the certifi library to somewhere else, Now you need to check from where the python was running inside the jupyter notebook, if it was running from a conda virtual environment then you will first have to activate it either from the cmd/powershell or from the conda prompt then you just simply install the certifi library inside that using pip.

    Once you are confirmed that the path were same in both the python shell and the jupyter notebook then in the same command prompt/power shell type:

    pip list | findstr "certifi"
    

    if you see a result that means certifi is installed to the same python location from where you are using it (i.e from the jupyter notebook)

    Example from my PC:

    Different Python Paths

    But Once I activated the conda environment which the jupyter notebook was using then:

    Same Python Paths

    Checking for a module ("requests" in my case) if it is installed or not