Problem with pywhatkit when deploying in streamlit cloud

Hi everyone;

I’m having this problem when deploying my code in streamlit cloud:

ModuleNotFoundError: No module named ‘pywhatkit’

My requirements.txt is this one:

And in the beginning of the code I’m writing this:
import streamlit as st
from collections import Counter
from PIL import Image
import base64
import io
import datetime
import pywhatkit

I’m not founding how to solve it. Can you help me?

Hey @AdrianCiges,

Can you please share a link to your GitHub repo?

Hi Caroline, sure!


Hey @AdrianCiges,

I forked your repo and deployed it here, and it doesn’t seem to be hitting that error

Yes, because I commented the line that breakes the rule

#import pywhatkit

If you delete de # the code will break

Hey @AdrianCiges,

I’m seeing a different error when I deploy your app:

2023-10-23 13:38:24.761 Uncaught app exception

Traceback (most recent call last):

  File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/", line 379, in _run_script

    exec(code, module.__dict__)

  File "/mount/src/comanda_cafes/main/", line 10, in <module>

    import pywhatkit

  File "/home/adminuser/venv/lib/python3.11/site-packages/pywhatkit/", line 6, in <module>

    from pywhatkit.main import print_sleep_time, check_window, sendwhatmsg, sendwhatmsg_to_group, info, playonyt, search, close_tab, sendwhatmsg_instantly, sendwhats_image

  File "/home/adminuser/venv/lib/python3.11/site-packages/pywhatkit/", line 3, in <module>

    import pyautogui as pg

  File "/home/adminuser/venv/lib/python3.11/site-packages/pyautogui/", line 246, in <module>

    import mouseinfo

  File "/home/adminuser/venv/lib/python3.11/site-packages/mouseinfo/", line 223, in <module>

    _display = Display(os.environ['DISPLAY'])


  File "<frozen os>", line 679, in __getitem__

KeyError: 'DISPLAY'

Do you have os.environ['DISPLAY'] set when you’re running the app locally?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.