Skip to content
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 'joblib' from 'sklearn.externals' #28

Open
Darkempire78 opened this issue Nov 17, 2020 · 20 comments
Open

Comments

@Darkempire78
Copy link

Darkempire78 commented Nov 17, 2020

I'm tying to test the module but it is do not works :/

image

@preetshah21699
Copy link

The same error occurs with me as well. It didn't occur earlier, like 5-10 days back. However, it appeared today, suddenly.

@Darkempire78
Copy link
Author

@preetshah21699 Currently the module is not updated... It's very sad, but a new version is available here : https://github.com/dimitrismistriotis/profanity-check (i use that for solve the issue, very well)

@dimitrismistriotis
Copy link
Contributor

dimitrismistriotis commented Nov 27, 2020

@Darkempire78

How we feel about this right now (me + @koti the other contributor)

image

@nitin-bommi
Copy link

@preetshah21699 Currently the module is not updated... It's very sad, but a new version is available here : https://github.com/dimitrismistriotis/profanity-check (i use that for solve the issue, very well)

How to install this?

@dimitrismistriotis
Copy link
Contributor

@nitin1901 🥁 🥁 🥁 ... and: https://pypi.org/project/alt-profanity-check/ Drop in replacement which we released just yesterday.

For the immediate forked repository, It is easy to install as is with something like this in your requirements.txt:

-e git+https://github.com/dimitrismistriotis/profanity-check.git#egg=profanity-check

@preetshah21699
Copy link

If we have a solution, why isn't it published on pypi.org?

@menkotoglou
Copy link

menkotoglou commented Jan 20, 2021

@preetshah21699 as stated on @dimitrismistriotis comment, the solution is published here: https://pypi.org/project/alt-profanity-check/

@preetshah21699
Copy link

@koti Yes, I saw it. But it just doesn't make sense to have the same thing under a completely different name. But anyway, thanks.

@dimitrismistriotis
Copy link
Contributor

dimitrismistriotis commented Jan 20, 2021

If we have a solution, why isn't it published on pypi.org?

A few things here:

  • It is not our responsibility to publish our solutions anywhere as nobody employs us to do so. We forked repository, then we created a package to published it in pypi. This volunteer free work for people like you.
  • ... (continuing from above) you could see it by reading the comment before you posted your comment.

But it just doesn't make sense to have the same thing under a completely different name.

We cannot merge on this repository and even if we could this might break work of people who depend on it as-is.

About "same thing under a completely different name": it is called forking and there are TONS of forks around, and the name is deliberately not "completely" different, we had the same name prefixed with "alt-".

But anyway, thanks.

Welcome. I guess while writing this that I probably overreacted, it took us some hours and learning to do this.

@nonbeing
Copy link

Thanks @dimitrismistriotis, @koti and all the other contributors for your work, really appreciate that you are still updating and keeping this work alive 👍

@menkotoglou
Copy link

Hey everyone, we just wanted to update you on this and announce that @dimitrismistriotis and I created an API for the library. In fact, it is a wrap of the alt-profanity-check package you can find here: https://pypi.org/project/alt-profanity-check/.

You can find the API here: https://rapidapi.com/mistriotis-mistriotis-default/api/profanity-check1.

Feedback, questions and subscriptions are highly appreciated. Please feel free to reach out to both of us for any questions or feedback about the API.

@CrashtestEnigma
Copy link

Hey everyone, we just wanted to update you on this and announce that @dimitrismistriotis and I created an API for the library. In fact, it is a wrap of the alt-profanity-check package you can find here: https://pypi.org/project/alt-profanity-check/.

You can find the API here: https://rapidapi.com/mistriotis-mistriotis-default/api/profanity-check1.

Feedback, questions and subscriptions are highly appreciated. Please feel free to reach out to both of us for any questions or feedback about the API.

ah hello, when i try to check if a string is offensive it prints nothings and ends. the exit code is 0.

@menkotoglou
Copy link

@CrashtestEnigma, we need more information on this. What's your input? The library returns 0 for "Not offensive" and 1 for "offensive". How did you try to check the string? Did you use the API we created?

@CrashtestEnigma
Copy link

@koti Yes, I used the API you guys created. I tried to test it exactly how the documentation usage told me to. I used the predict function to test if "Hello" was offensive. My exact code was:

from profanity_check import predict

predict(['Hello'])

The code snippet returns nothing. Neither 1 nor 0. The exit code is 0.
I'm new to programming in general so I might be making a mistake. If you need any more information I would be glad to tell!

@BradKML
Copy link

BradKML commented Apr 29, 2021

@CrashtestEnigma That is a very beginner mistake, as this is not Javascript.
You will need to either print it explicitly or store that into the variable. In the Python terminal or Python Notebook, you can just type out a variable and ask for a result, but this does not apply to running code as a Python file.

@CrashtestEnigma
Copy link

@BrandonKMLee oh i see. thank you for correcting me, i'm sure i can learn from this.

@priyabratap
Copy link

priyabratap commented Nov 4, 2021

I am facing the same issue, Please find the below output.

Traceback (most recent call last): File "/Users/priyabratajena/projects/pj-scripts/python/content_moderation/challenge_creation.py", line 10, in <module> from profanity_check import predict, predict_prob File "/Users/priyabratajena/projects/pj-scripts/python/content_moderation/pjenv/lib/python3.9/site-packages/profanity_check/__init__.py", line 1, in <module> from .profanity_check import predict, predict_prob File "/Users/priyabratajena/projects/pj-scripts/python/content_moderation/pjenv/lib/python3.9/site-packages/profanity_check/profanity_check.py", line 3, in <module> from sklearn.externals import joblib ImportError: cannot import name 'joblib' from 'sklearn.externals' (/Users/priyabratajena/projects/pj-scripts/python/content_moderation/pjenv/lib/python3.9/site-packages/sklearn/externals/__init__.py)

I changed the import statement in this line /Users/priyabratajena/projects/pj-scripts/python/content_moderation/pjenv/lib/python3.9/site-packages/profanity_check/profanity_check.py"
into import joblib

(pjenv) priyabratajena@Priyabratas-MacBook-Pro content_moderation % python3 challenge_creation.py /Users/priyabratajena/projects/pj-scripts/python/content_moderation/pjenv/lib/python3.9/site-packages/sklearn/base.py:324: UserWarning: Trying to unpickle estimator CountVectorizer from version 0.20.2 when using version 1.0.1. This might lead to breaking code or invalid results. Use at your own risk. For more info please refer to: https://scikit-learn.org/stable/modules/model_persistence.html#security-maintainability-limitations warnings.warn( Traceback (most recent call last): File "/Users/priyabratajena/projects/pj-scripts/python/content_moderation/challenge_creation.py", line 10, in <module> from profanity_check import predict, predict_prob File "/Users/priyabratajena/projects/pj-scripts/python/content_moderation/pjenv/lib/python3.9/site-packages/profanity_check/__init__.py", line 1, in <module> from .profanity_check import predict, predict_prob File "/Users/priyabratajena/projects/pj-scripts/python/content_moderation/pjenv/lib/python3.9/site-packages/profanity_check/profanity_check.py", line 7, in <module> model = joblib.load(pkg_resources.resource_filename('profanity_check', 'data/model.joblib')) File "/Users/priyabratajena/projects/pj-scripts/python/content_moderation/pjenv/lib/python3.9/site-packages/joblib/numpy_pickle.py", line 587, in load obj = _unpickle(fobj, filename, mmap_mode) File "/Users/priyabratajena/projects/pj-scripts/python/content_moderation/pjenv/lib/python3.9/site-packages/joblib/numpy_pickle.py", line 506, in _unpickle obj = unpickler.load() File "/usr/local/Cellar/[email protected]/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pickle.py", line 1212, in load dispatch[key[0]](self) File "/usr/local/Cellar/[email protected]/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pickle.py", line 1528, in load_global klass = self.find_class(module, name) File "/usr/local/Cellar/[email protected]/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pickle.py", line 1579, in find_class __import__(module, level=0) ModuleNotFoundError: No module named 'sklearn.svm.classes' (pjenv) priyabratajena@Priyabratas-MacBook-Pro content_moderation %

I tried the above solutions and it's not working

python 3.9

Package Version


boto3 1.19.10
botocore 1.22.10
jmespath 0.10.0
joblib 1.1.0
numpy 1.21.3
pip 21.1.1
profanity-check 1.0.3
PyMySQL 1.0.2
python-dateutil 2.8.2
s3transfer 0.5.0
scikit-learn 1.0.1
scipy 1.7.1
setuptools 56.0.0
six 1.16.0
threadpoolctl 3.0.0
urllib3 1.26.7

@dimitrismistriotis @vzhou842 @vchulski

@menkotoglou
Copy link

@priyabratap this library is deprecated. You could find an active alternative here and here.

@priyabratap
Copy link

priyabratap commented Nov 4, 2021

@koti the alternative also was not working.
Just I created a new venv and it started working with alt-profanity-check.

Thanks a lot

@menkotoglou
Copy link

OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants