Python Forum

Full Version: ModuleNotFoundError: No module named 'stop_words'
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
am trying to run this code but am getting this error

from __future__ import division
from sklearn.model_selection import train_test_split
from stop_words import get_stop_words
import matplotlib.pyplot as plt
from collections import Counter
import pandas as pd
import numpy as np
import string
import re


error

ModuleNotFoundError: No module named 'stop_words'
stop-words is not a built-in module.
You'll need to install it before you can use it
i have tried am using jupyter

from stop_words import get_stop_words

stop_words = get_stop_words('en')
stop_words = get_stop_words('english')

from stop_words import safe_get_stop_words

stop_words = safe_get_stop_words('unsupported language')



but still getting this error



---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-5-62c73f478eb9> in <module>
----> 1 from stop_words import get_stop_words
2
3 stop_words = get_stop_words('en')
4 stop_words = get_stop_words('english')
5

ModuleNotFoundError: No module named 'stop_words'
How did you try to install it?
Looks like it didn't work.
Basic install.
# pip version(newest 19.1.1)and version of Python that stop-words get installed to python 3.7
λ pip -V
pip 19.1.1 from c:\python37\lib\site-packages\pip (python 3.7)

# install
E:\div_code\read
λ pip install stop-words
Collecting stop-words
  Downloading ...........
Installing collected packages: stop-words
Successfully installed stop-words-2018.7.23

# Test that it work
E:\div_code\read
λ python
>>> import stop_words
>>>
>>> stop_words.__VERSION__
(2018, 7, 23)
>>> exit()
am using Jupyter for anaconda
It's the same way,i do in Scripts folder where pip and conda is placed.
If Anaconda is set in Windows Path,then it will work from anywhere in cmd.
G:\Anaconda3\Scripts
λ pip -V
pip 19.0.3 from G:\Anaconda3\lib\site-packages\pip (python 3.7)

G:\Anaconda3\Scripts
λ pip install stop-words
Collecting stop-words
Installing collected packages: stop-words
Successfully installed stop-words-2018.7.23

G:\Anaconda3\Scripts
λ cd ..

G:\Anaconda3
λ python
Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
>>> import stop_words
>>>
>>> stop_words.__VERSION__
(2018, 7, 23)
Anaconda and other ways to run Python