I tried to import a library but it does not 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 he 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'
While I have this module:
(mybot_env) mike@mike-thinks:~/Programming/mybot$ python3 -m pip install textblob
Collecting textblob
Using cached https://files.pythonhosted.org/packages/11/18/7f55c8be6d68ddc4036ffda5382ca51e23a1075987f708b9123712091af1/textblob-0.15.1-py2.py3-none-any.whl
Requirement already satisfied: nltk>=3.1 in ./mybot_env/lib/python3.5/site-packages (from textblob) (3.3)
Requirement already satisfied: six in ./mybot_env/lib/python3.5/site-packages (from nltk>=3.1->textblob) (1.11.0)
Installing collected packages: textblob
Successfully installed textblob-0.15.1
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 does not work.