Streamlit YouTube Downloader App Works Locally but Fails on Streamlit Cloud with 'ModuleNotFoundError: yt_dlp

Hi Streamlit Community! :waving_hand:

I’m building a YouTube video downloader app using yt-dlp. It works perfectly locally (via streamlit run), but when I deploy it to Streamlit Community Cloud, I get this error:

ModuleNotFoundError: This app has encountered an error.  
File "/mount/src/yt-video-downloader/youtube-downloader-app.py", line 3, in <module>  
import yt_dlp  

What I’ve Tried:

  1. Confirmed the correct import: My code uses import yt_dlp (underscore).
  2. Added yt-dlp to requirements.txt:
    yt-dlp>=2023.11.16  
    streamlit  
    pandas  
    
  3. Verified packages.txt for ffmpeg:
    ffmpeg  
    
  4. Tested locally: Works flawlessly with pip install -r requirements.txt.

The Problem:

  • Streamlit Cloud seems unable to install yt-dlp despite it being in requirements.txt.
  • No clear logs (error message is redacted).

Questions:

  1. Is yt-dlp supported on Streamlit Cloud?
  2. Are there additional dependencies needed (e.g., ffmpeg)?
  3. Could this be a platform restriction (e.g., blocked by YouTube’s ToS)?

Thanks for your help! :folded_hands:


I don’t think the error is related to yoru questions. Most likely streamlit cloud is not seeing your requirements file because it is misspelled or not in the right place.

1 Like