Import in notebook jupyter despite installing the library called

Asked

Viewed 306 times

0

I tried to import a library but it doesn’t seem to be added to jupyter notebook

import sys

print("sys.executable:\n",sys.executable)
print("sys.path:\n",sys.path)

from textblob import TextBlob

And that gives me

    sys.executable:
     /usr/bin/python3
    sys.path:
     ['', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', 
'/usr/lib/python3.5/lib-dynload', '/home/mike/.local/lib/python3.5/site-packages',
'/usr/local/lib/python3.5/dist-packages',
'/usr/lib/python3/dist-packages',
'/usr/local/lib/python3.5/dist-packages/IPython/extensions',
'/home/mike/.ipython']

    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    <ipython-input-2-ab115a97c7b9> in <module>()
         10 print("sys.path:\n",sys.path)
         11 
    ---> 12 from textblob import TextBlob
         13 import nltk
         14 from scipy import spatial

    ImportError: No module named 'textblob'

And it works well with the interpreter

(mybot_env) mike@mike-thinks:~/Programming/mybot$ python
Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import textblob
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
  return f(*args, **kwds)
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
  return f(*args, **kwds)
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
  return f(*args, **kwds)
>>> 

To solve the problem, I tried

python -m pip install ipykernel
python -m  ipykernel install

But it doesn’t work.

  • You tried to install the textblob? Using the doc: pip install -U textblob and python -m textblob.download_corpora

  • @Tuxpilgrim Yes, and works well with the interpreter

  • Which version of Python did you install it in? 2 or 3?

  • @Tuxpilgrim 3.5.2

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.