5

I have followed the instruction in Trouble installing TextBlob for Python for TextBlob installation in the Windows 7. It got installed but when I go to Python Idle and type import TextBlob it says

No module named TextBlob

How to solve this problem?

Or can I directly place the libraries associated with the package in the Python Lib folder and try to import it in the program? If it is advisable please tell the procedure to do that. Will it work?

Any help will be highly appreciated.

2
  • I received this error while trying to install the corpus on a mac as well Commented Dec 11, 2014 at 21:25
  • Which instructions did you follow? Do you have pip installed? That makes installation easier. Commented Jun 23, 2015 at 2:31

5 Answers 5

4

Install it with conda. It worked for me!

conda install -c conda-forge textblob
Sign up to request clarification or add additional context in comments.

Comments

3

Try this:

from textblob import TextBlob

Source: TextBlob package description

2 Comments

It is python code and will work in the interpreter on any platform. Your issue is to actually install the package.
how can i add custom data or corpus to textblob ? so that it can do spell check right . @ncocacola
3

In Windows, if you try installing textblob or any other packages in python, then you have to give administrative rights to the application through which you are installing the packages.

For me, it gave the same error while I was installing it through Pycharms. I gave administrative rights and it worked just fine!

pip install -U textblob
python -m textblob.download_corpora

To import just type:

from textblob import TextBlob

An example:

text = '''
The titular threat of The Blob has always struck me as the ultimate movie
monster: an insatiably hungry, amoeba-like mass able to penetrate
virtually any safeguard, capable of--as a doomed doctor chillingly
describes it--"assimilating flesh on contact.
Snide comparisons to gelatin be damned, it's a concept with the most
devastating of potential consequences, not unlike the grey goo scenario
proposed by technological theorists fearful of
artificial intelligence run rampant.
'''

blob = TextBlob(text)
blob.tags           # [('The', 'DT'), ('titular', 'JJ'),
                    #  ('threat', 'NN'), ('of', 'IN'), ...]

blob.noun_phrases   # WordList(['titular threat', 'blob',
                    #            'ultimate movie monster',
                    #            'amoeba-like mass', ...])

for sentence in blob.sentences:
    print(sentence.sentiment.polarity)
# 0.060
# -0.341

blob.translate(to="es")  # 'La amenaza titular de The Blob...'

Comments

0

try

pip install textblob

if you dont have pip, you can get it here, it's really usefull

Comments

0
conda install -c conda-forge textblob

This worked in Jupyter environment.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.