Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't import nltk module in Juypter notebook?

I have tried importing nltk module using notebook (Juypter) but its keep showing the error.

ImportError                               Traceback (most recent call last)
<ipython-input-1-b06499430ee0> in <module>()
----> 1 import nltk

ImportError: No module named nltk.   

I have looked at the various solutions. I am able to import the module with the terminal but not in the notebook.

like image 875
Learner11 Avatar asked Jun 19 '16 14:06

Learner11


People also ask

Can we use NLTK in Jupyter Notebook?

NLTK is a standard python library that provides a set of diverse algorithms for NLP. It is one of the most used libraries for NLP and Computational Linguistics. Now, let us see how to install the NLTK library. To install in Jupyter Notebook, type the below command in a cell and click on run.

How do I import NLTK in Anaconda?

Through Anaconda First, to install Anaconda, go to the link www.anaconda.com/distribution/#download-section and then select the version of Python you need to install. You need to review the output and enter 'yes'. NLTK will be downloaded and installed in your Anaconda package.


1 Answers

Open a command prompt and write:

pip install nltk

This will install the natural language toolkit, after the installation is complete, open Jupyter Notebook and type:

import nltk
nltk.download()

It will take some time and after some time for the auto-configuration of the Jupyter Notebook. Later, you would be able to use is without any issues. Let me know, if you still face any problem.

like image 59
Rishi Parikh Avatar answered Oct 02 '22 02:10

Rishi Parikh