-
Notifications
You must be signed in to change notification settings - Fork 996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImportError: cannot import name sentiment #8
Comments
In the example there is an alternative way to import: from vaderSentiment.vaderSentiment import sentiment as vaderSentiment Would it help? |
Yes, that helped, thank you. Apologies for the unnecessary issue. Though I Any advice on how to change/add to the dictionary? Basically, I am Jon On Mon, May 9, 2016 at 4:00 PM, mp31415 notifications@github.com wrote:
Jon Atkins |
I didn't try to modify the dictionary, but I don't see why "nazi" would be any different from any other entry in the dictionary. I did notice though that on non-Windows platform encoding of the dictionary must be changed to UTF-8 and some invalid entries must be fixed (see one of the recent issues). I also noticed that dictionary file may be put next to your python file (in the same folder), because vader first tries to open it there and only if it fails falls back to the original file in the vader package. |
When I tried both possible ways to import listed above, I got the following error: File "/usr/anaconda3/lib/python3.5/site-packages/vaderSentiment/vaderSentiment.py", line 23 Is this a python 3 issue or something? |
Thanks! The new update (with new pip install) has better compatibility support for Python 3 to address cvint13's issue, and helps with the encoding/decoding issues. The lexicon dictionary file has been encoded with UTF-8 unicode by default (I hope) for better cross-os performance. I've implemented code to automatically detect where the dictionary file is installed (as long as you didn't change it's location relative to where the actual "vaderSentiment.py" file got installed), so no longer any need to manually put a copy of the dictionary file next to your python file (in the same folder)... from what I can tell, my implementation should work across OSs. |
@cjhutto Before i imported using: "from vaderSentiment.vaderSentiment import sentiment as vaderSentiment" on python 2.7 |
(Note: this upgrade uses Python 3x) after you've run try this in your python terminal or IDE:
|
@cjhutto What are the instructions to install the previous version? |
You can always use |
I am still getting the same error even after trying both the import options. from vaderSentiment import sentiment as vaderSentiment Does anyone have any solution to this?? |
Hi @harika5, As seen in the updated code examples on the first page of the VADER GitHub, your import should look like this:
then you should be able to run your text though the analyzer like this:
|
hi, I was able to download vaderSentiment, but each time I try to import it from python using this from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer, I recieve this error:
|
ModuleNotFoundError Traceback (most recent call last) ModuleNotFoundError: No module named 'vaderSentiment' |
@Raunak24x7 i am getting the same error . Have you been able to fix it yet ? |
Have you looked at the code examples provided on the VADER GitHub homepage? I think your solution is already provided there... for example, see the new import method:
|
`from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer analyzer = SentimentIntensityAnalyzer()` File ".\vaderSentiment.py", line 4, in I have used vaderSentiment recently like a month back and it worked like a charm . i went back to my code to do some more digging and now it shows me this . 1 month back this exact thing was working just fine . PS - i have uninstalled the package too . Reinstalled it again . and that didnt help me too |
@cjhutto Okay , I fixed the problem . I still dont know what was it exactly. But i thought the cached image must have something wrong with it or I came upon this discussion where the package may not get fetched for python version you are using |
Oh good! |
I have read all of them but any of them did not work for me. I am using tabPy on Tableau. |
Thank you for the clarification
On Thu, Jan 28, 2021 at 4:02 PM yelizkilinc ***@***.***> wrote:
I have read all of them but any of them did not work for me. I am using
tabPy on Tableau.
I am getting: 'ModuleNotFoundError : No module named 'vaderSentiment''
error.
I can see that module exists on
C:\Python39\Lib\site-packages\vaderSentiment.
My python version is 3.9.1
I hope you have an idea?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF3MT4VPB3HT5CXIRUD2UT3S4F37JANCNFSM4CDHEBDQ>
.
--
Best Regards,
Raunak Mishra
*Contact Number :*(+91)-8750324627
|
I solved the above issue. TabPy was looking to another path, not Python folder. I copied files to correct path. But this time, init.py file is empty. And I am getting ImportError : cannot import name 'SentimentIntensityAnalyzer' from 'vaderSentiment' (c:\anaconda3\lib\site-packages\vaderSentiment_init_.py) error. I wrote by myself, but it did not accept. |
Please do not try to solve. I solved it, it can be done without init.py. I came at the beginning and your suggestions above worked. Thanks |
Ok, thanks.
On Thu, Jan 28, 2021 at 5:10 PM yelizkilinc ***@***.***> wrote:
Please do not try to solve. I solved it, it can be done without *init*.py.
I came at the beginning and your suggestions above worked. Thanks
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF3MT4VQLA43B3CTRY7HFKLS4GD7JANCNFSM4CDHEBDQ>
.
--
Best Regards,
Raunak Mishra
*Contact Number :*(+91)-8750324627
|
So how did you fix it? As I am getting this error as well: ImportError: cannot import name 'SentimentIntensityAnalyzer' from 'vaderSentiment' (c:\Users\Aiden\OneDrive\Documents\WsB workspace VS.venv\lib\site-packages\vaderSentiment_init_.py) |
|
Ok, I'll check it out.
On Fri, Feb 19, 2021 at 10:07 PM kirch-47 ***@***.***> wrote:
Please do not try to solve. I solved it, it can be done without *init*.py.
I came at the beginning and your suggestions above worked. Thanks
So how did you fix it? As I am getting this error as well: ImportError:
cannot import name 'SentimentIntensityAnalyzer' from 'vaderSentiment'
(c:\Users\Aiden\OneDrive\Documents\WsB workspace
VS.venv\lib\site-packages\vaderSentiment__init__.py)
@yelizkilinc <https://github.com/yelizkilinc>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF3MT4XSWH45A7PNRPCVGELS73HI5ANCNFSM4CDHEBDQ>
.
--
Best Regards,
Raunak Mishra
*Contact Number :*(+91)-8750324627
|
I had the same problems. The resolution is I deleted the git cloned vadersentiment folder. then I did
Good luck guys |
Trying to install sentiments for my web app that work on python flaks i pip install sentiments but when I run code it shows module name sentiments not found |
I installed vaderSentiment with pip and have ensured it is in the correct file, un- and re-installed it, attempted to upgrade pip, attempted to change the permissions for the files and am still having difficulty using this library. Error below:
Traceback (most recent call last):
File "search_twitter.py", line 1, in
from vaderSentiment import sentiment as vaderSentiment
ImportError: cannot import name sentiment
Any help as soon as possible would be greatly appreciated as my project is due on Tuesday. Thank you very much,
Jon
The text was updated successfully, but these errors were encountered: