Running TextBlob in Python3
Asked Answered
A

1

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?

Artery answered 13/2, 2015 at 22:0 Comment(4)
What operating system?Dowell
Elementary OS - Luna.Artery
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: #10763940 maybe that will shed some light.Dowell
How can I follow something like this using virtualenv with IPython? I can't think of a way.Artery
G
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.

Glidden answered 13/2, 2015 at 22:36 Comment(2)
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?Artery
How do we do it in windows? I get the same NoModuleFoundErrorMoribund

© 2022 - 2024 — McMap. All rights reserved.