el-cornetillo / senti-py

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

Issue while importing the classifier #14

Open TheRaai opened 4 years ago

TheRaai commented 4 years ago

Hi, first of all just wanted to say that I really liked your job on this project, it's seems like something really useful and well done.

I just have one issue, whenever I try to import it, it tells me

ImportError: cannot import name 'joblib' from 'sklearn.externals' 

and I was wondering if there was any way someone could help me with this.

Thanks in advance!

kurtrottmann commented 4 years ago

Hi, the dependencies of package spanish_sentiment_analysis are not specified, then if you install it using pip, the last version of scikit-learn will be installed what is wrong. You must use an older compatible version of scikit-learn. Use scikit-learn 0.19.2 works for me.

These are my steps to make it works in python 3.8:

$ pip install numpy scipy scikit-learn==0.19.2 spanish_sentiment_analysis ipython
$ python
>>> from classifier import SentimentClassifier
[deprecation warning message]
>>> clf = SentimentClassifier()
>>> print(clf.predict('Esta muy buena esa pelicula'))
0.9313572043117736

These are my dependencies exact versions:

$ pip list
Package                    Version 
-------------------------- --------
backcall                   0.2.0   
click                      7.1.2   
decorator                  4.4.2   
ipython                    7.15.0  
ipython-genutils           0.2.0   
jedi                       0.17.0  
joblib                     0.15.1  
marisa-trie                0.7.5   
nltk                       3.5     
numpy                      1.18.5  
parso                      0.7.0   
pexpect                    4.8.0   
pickleshare                0.7.5   
pip                        19.2.3  
prompt-toolkit             3.0.5   
ptyprocess                 0.6.0   
Pygments                   2.6.1   
regex                      2020.6.8
scikit-learn               0.19.2  
scipy                      1.4.1   
setuptools                 41.2.0  
six                        1.15.0  
sklearn                    0.0     
spanish-sentiment-analysis 1.0.0   
tqdm                       4.46.1  
traitlets                  4.3.3   
wcwidth                    0.2.4
TheRaai commented 4 years ago

That worked like a charm, thank you very much!

afernandezh0801 commented 2 years ago

For me it also worked with this config

Pythonversion: 3.7.8

requeriments.txt:

backcall==0.2.0
click==8.1.3
colorama==0.4.4
cycler==0.11.0
debugpy==1.6.0
decorator==5.1.1
entrypoints==0.4
fonttools==4.33.3
importlib-metadata==4.11.4
ipykernel==6.15.0
ipython==7.34.0
jedi==0.18.1
joblib==1.1.0
jupyter-client==7.3.4
jupyter-core==4.10.0
kiwisolver==1.4.3
marisa-trie==0.7.7
matplotlib==3.5.2
matplotlib-inline==0.1.3
nest-asyncio==1.5.5
nltk==3.7
numpy==1.21.6
packaging==21.3
pandas==1.3.5
parso==0.8.3
pickleshare==0.7.5
Pillow==9.1.1
prompt-toolkit==3.0.29
psutil==5.9.1
Pygments==2.12.0
pyparsing==3.0.9
python-dateutil==2.8.2
pytz==2022.1
pywin32==304
pyzmq==23.1.0
regex==2022.6.2
scikit-learn==0.20.4
scipy==1.7.3
six==1.16.0
sklearn==0.0
spanish-sentiment-analysis==1.0.0
tornado==6.1
tqdm==4.64.0
traitlets==5.2.2.post1
typing_extensions==4.2.0
wcwidth==0.2.5
wordcloud==1.8.1
zipp==3.8.0
brusacco commented 2 years ago

This worked for me!