I am trying to perform sentiment analysis on an article from Wikipedia. I need to use the newspaper Python package and am having difficulties implementing it into my code. I have downloaded pip from the terminal and opened the venv virtual environment, and downloaded nltk, textblob, and newspaper3k. However, when I go to run the code it says no such newspaper module exists even though I have downloaded it from the terminal multiple times? I have updated pip and reran my code, but am receiving the same error. What could I do to resolve the issue? Thank you!
I have tried researching the issue, I opened a virtual environment and downloaded the packages inside that. Along with that I updated pip and reran the code, and tried downloading newspaper3k multiple different times with the same result. I am using Google Colaboratory to run code.
Here is the error I am receiving.
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-8-71f9b211be5a> in <module>
1 from textblob import TextBlob
----> 2 from newspaper import Article
3
4 url = 'https://en.wikipedia.org/wiki/Mathematics'
5
ModuleNotFoundError: No module named 'newspaper'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-8-71f9b211be5a> in <module>
1 from textblob import TextBlob
----> 2 from newspaper import Article
3
4 url = 'https://en.wikipedia.org/wiki/Mathematics'
5
ModuleNotFoundError: No module named 'newspaper'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
But in the terminal, I have downloaded newspaper3k:
Requirement already satisfied: six in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages (from feedfinder2>=0.0.4->newspaper3k) (1.15.0)
Please let me know what I could do to resolve the error I receive in Google Colaboratory - I am unclear what is causing it since I have downloaded the packages. I suspect the error might be caused with the directory I imported the modules in and the directory of the Google Colaboratory file not matching -- I created 2 virtual environments and downloaded the modules in those. I am not sure which directory my google colaboratory file is in and whether or not it matters if it is in the same directory as the modules. If this is the case, how would i go about to move the Colaboratory file to the same directory? Thank you so much!