talon icon indicating copy to clipboard operation
talon copied to clipboard

Joblib error

Open yatanasoff opened this issue 4 years ago • 9 comments

Hi, when trying the machine learning approach to extract the text and signature from the email that is in the readme i get this error

ImportError: cannot import name 'joblib' from 'sklearn.externals' (/home/christmas/Projects/emails/emails/lib/python3.7/site-packages/sklearn/externals/__init__.py)

I'm on debian buster, using venv/pipenv and getting that result Can anybody help me fix this? thanks

yatanasoff avatar Feb 08 '21 23:02 yatanasoff

is this library deprecated?

yatanasoff avatar Feb 09 '21 21:02 yatanasoff

I am also getting a similar error

mann2107 avatar Feb 26 '21 16:02 mann2107

I solved this issue by uninstalling scikit-learn and reinstalling a lower version. To remove the current version, you can run pip uninstall scikit-learn

Then, to re install v 0.22.2 run pip install scikit-learn==0.22.2

mann2107 avatar Feb 26 '21 16:02 mann2107

thx @mann2107 i took another approach and removed the machine learning logic, at the end i just needed the regex pack, but ill try this

yatanasoff avatar Feb 27 '21 11:02 yatanasoff

@atanasoff-yordan I faced exactly the same issue and submitted pull request: https://github.com/mailgun/talon/pull/219

vovanec avatar May 14 '21 02:05 vovanec

I have the same issue, adding scikit-learn==0.22.2 to requirements.txt didn't help me. Is there any info when new release wit PR can be published?

vedmant avatar Jun 10 '21 11:06 vedmant

I solved this issue by uninstalling scikit-learn and reinstalling a lower version. To remove the current version, you can run pip uninstall scikit-learn

Then, to re install v 0.22.2 run pip install scikit-learn==0.22.2

Thanks It worked...

This is the original warning which sckit-learn is throwing in 0.22.2 version:

FutureWarning: sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib. If this warning is raised when loading pickled models, you may need to re-serialize those models with scikit-learn 0.21+.

ankygupta9999 avatar Aug 16 '21 11:08 ankygupta9999

I think this may be a problem with the pypi version of talon.

If you look here on the repo in classifier.py, you see the includes are

from numpy import genfromtxt
import joblib
from sklearn.svm import LinearSVC

But if you do a fresh install of talon pip install --force-reinstall talon and look at the classifier.py in the lib, you'll see that the imports are:

from numpy import genfromtxt
from sklearn.externals import joblib
from sklearn.svm import LinearSVC

Fwhiteiv avatar Sep 02 '21 00:09 Fwhiteiv

can confirm

pip install git+https://github.com/mailgun/talon/

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

toasta avatar Jan 25 '22 08:01 toasta