6

I installed textblob using pip as given here.

Now, when I try to import this in python3.4 in terminal then it says

ImportError: No module named 'textblob'

Whereas, in python2.7 it imports happily. I have tried reinstalling it. I have even reinstalled pip. What is the problem here?

4
  • What operating system? Commented Feb 13, 2015 at 22:02
  • Elementary OS - Luna. Commented Feb 13, 2015 at 22:05
  • I can't speak to that OS specifically, but I'm pretty sure you could avoid this problem entirely by using a virtualenv. It seems like you pip installed textblob onto the PATH for python2.7, so it's not available to your py3.4 installation. This would be the solution on ubuntu: stackoverflow.com/questions/10763440/… maybe that will shed some light. Commented Feb 13, 2015 at 22:08
  • How can I follow something like this using virtualenv with IPython? I can't think of a way. Commented Feb 13, 2015 at 22:19

1 Answer 1

5

Elementary OS being an Ubuntu derivative,

$ sudo apt-get install python3-pip
...
$ pip3 install textblob

should do the trick. It is possible that you have to apply some minor variation to the above due to eventual differences between Elementary and Ubuntu.

Remember that Python 2.7 and Python 3.x are two independent systems, what you install in 2.7 is definitely NOT automatically available for 3.x and the converse is equally true.

Sign up to request clarification or add additional context in comments.

2 Comments

It gives Unable to locate package python3-pip. I followed this answer which gives me pip3. After running pip3 install textblob, textblob is installed in for python3.2. For, python3.4 python3.4 -m pip install textblob did the work. I have one question though. For packages which support both python2.7 and python3.4 is there a way to install that module once and import it in both versions of python?
How do we do it in windows? I get the same NoModuleFoundError

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.