el-cornetillo / senti-py

A sentiment Analysis classifier in spanish
121 stars 40 forks source link

No module named 'spanish_sentiment_analysis' #5

Open val-st opened 5 years ago

val-st commented 5 years ago

Hi Elliote

Thanks a lot for creating this awesome tool! While I wait for v2 to be released ( :-) ), I want to play around with the current version. It took me a while to figure out how to install marisa-trie (I kept getting error messages) but should now be all set. However, I can't get to run the program. I keep getting the following error message:

import spanish_sentiment_analysis Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'spanish_sentiment_analysis'

However, I already installed the module. If I try to reinstall it, I get the following message:

(base) ((User)):~ ((User))$ pip3 install spanish_sentiment_analysis Requirement already satisfied: spanish_sentiment_analysis in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (1.0.0) Requirement already satisfied: scipy in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from spanish_sentiment_analysis) (1.3.0) Requirement already satisfied: marisa-trie in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from spanish_sentiment_analysis) (0.7.5) Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from spanish_sentiment_analysis) (1.16.4) Requirement already satisfied: nltk in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from spanish_sentiment_analysis) (3.4.4) Requirement already satisfied: sklearn in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from spanish_sentiment_analysis) (0.0) Requirement already satisfied: six in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from nltk->spanish_sentiment_analysis) (1.12.0) Requirement already satisfied: scikit-learn in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from sklearn->spanish_sentiment_analysis) (0.21.2) Requirement already satisfied: joblib>=0.11 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from scikit-learn->sklearn->spanish_sentiment_analysis) (0.13.2)

Did I do something wrong? I'm a newbie so any help is much appreciated. Thank you!

el-cornetillo commented 5 years ago

Hi val-st I'm surprised you got some troubles with the installation of marisa-trie, it is listed among the dependencies of the package and should not cause problems. However, if you coud bypass the issue and install it your way, I invite you to take a look at the mini-demo notebook. That is not so clean, but the name of the package on pypi is different from the name it has once installed into you site-packages folder.

You should access it via :
from classifier import * clf = SentimentClassifier() clf.predict("Hola buen diaaa!")

spanish_sentiment_analysis is just the name of the package hosted on pypi, but then it is installed on your computer under the name "classifier" (which is not a good name at all, i'm aware of that)

I hope that you can get it working! Good week

val-st commented 5 years ago

Hi Elliot,

Thanks so much for your prompt answer! I did not realize that the package was called classifier, but I had already tried the instructions from the demo. However, I get the same error message:

Traceback (most recent call last): File "sentiment.py", line 1, in from classifier import * ModuleNotFoundError: No module named 'classifier'

Also, when I list all the modules (with help("modules")), it does not list one called 'classifier'. But when I try to (re-) install spanish_sentiment_analysis, it does seem to already be installed (see first entry of this thread). Do you think the problem is with the installation?

Thanks a lot!

el-cornetillo commented 5 years ago

Uyy, yes it seems like something is messed up with the installation, but it's hard to evaluate from my perspective.

Something like this could happen when you have several python versions and/or several environments

Do you use conda ? I just tried to create a new env with conda, pip install the package from within the env and it works

val-st commented 5 years ago

Yes! This works! Thank you!