vaderSentiment Module Not Found Error


I have been trying to deploy an app but when triying to call a subprocess python file importing vaderSentiment library it throw me Module not found error.

Traceback (most recent call last):", line 2, in <module>
    from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
ModuleNotFoundError: No module named 'vaderSentiment'

Requirements file


Hi @Watchdog1, welcome to our forums! :wave:

I’m not too familiar with vaderSentiment but don’t you have to install NLTK too?


Hi @Charly_Wargnier I’ll try adding it to reqs file but not sure this worked completely fine locally. If this doesn’t work then?

you can try to use pipreqs to automatically generate your requirements.txt file and try to reboot the website to see if it works, watch this article here: How to Auto Generate requirements.txt (Dependencies) in Python - 3 examples

Hi @Melo04 I did try that but it didn’t work I don’t understand why is it throwing that error. I am sure I am making a silly mistake somewhere. Argh!

hmm you can try this and add to your requirements.txt, not sure if it works:
vaderSentiment @ git+(github repo link for vaderSentiment)

Can you pls share your github repo link

I suspect that is where your issue lies.

Hi @Goyo what else could I do then maybe write those functions in the other file in itself? Let me know any other methods.

I don’t know what you are doing and why so I cannot answer that.

I do know that subprocesses are somewhat tricky and people often make mistakes, hence my suspicion.

@Goyo Hi thank you for your reply I am attaching a block for your reference to understand better maybe then you could help me solve it


    page_title="Watchdog: Let's manage disinformation",

with st.container():
    menu, title = st.columns([3,1])

    with menu:
        selected2 = option_menu(
        options=["Home", "Case Studies", "Analysis"],
        icons=["house", "book", "bar-chart-fill"],
        if selected2 == "Analysis":
        if selected2 == "Case Studies":
    with title:
    st.write('Spreading Awareness')
    col1, col2, col3 = st.columns(3)

    with col1:
        st.subheader("Interactive Visuali")

    with col2:

    with col3:
        st.subheader("R Data")

    # Create a placeholder for the video link
    if "url" not in st.session_state:
        st.session_state["url"] = ""   
    url = st.text_input("Enter the link to the video:", st.session_state["url"])

    if url:
        st.session_state["url"] = url
    if st.button("Let's Write a Story?"):
  ["python", "", url])
            st.write('We are analysing it in our newsroom')
        except Exception as e:
            st.error(f"An error occurred: {e}")

from j.article_transcript import ArticleTranscript
from j.youtube_transcript import YoutubeTranscript
#from j import youtube_transcript
#from j import article_transcript
import spreadsheet
import requests
import sys
from bs4 import BeautifulSoup
import youtube_transcript_api

# No change needed
def is_url_from_source(url):
    Checks if the url comes from a valid source (youtube or one of the article sources).
    Returns True if link contains 'youtube' or one of the valid sources. False otherwise.
    if 'youtube' in url and is_youtube_valid(url):
        return True
        article_sources = [source['source'] for source in article_transcript.SOURCES]
        for source in article_sources:
            if source in url:
                return True
    return False

def is_youtube_valid(url):
    reqs = requests.get(url)
    soup = BeautifulSoup(reqs.text, 'html.parser')

    if soup.find('meta', itemprop='name') is None:
        return False
    return True

from j.transcript import Transcript
from nltk.sentiment.vader import SentimentIntensityAnalyzer
import requests
from bs4 import BeautifulSoup
from deep_translator import GoogleTranslator
import re

This is where the error shows while running the subprocess", line 2, in <module>
    from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
ModuleNotFoundError: No module named 'vaderSentiment'["python", "", url])

This will run the system python, not the python in your virtual environment. Use this instead:[sys.executable, "", url])

@Goyo I tried this but when I host it online it gives me this error, I did import it.

name ‘sys’ is not defined

Is there an alternative way I could, run that file?

You need to import sys first.

Hi @Goyo Thank you so much for your help, this worked for me

import nltk
import sys'vader_lexicon')
1 Like

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