nltk: AttributeError: module 'nltk' has no attribute 'download

#code 

import nltk
nltk.download()
Traceback (most recent call last):
  File "nltk.py", line 2, in <module>
    import nltk
  File "/Users/antonionogueras/Desktop/NLTK/nltk.py", line 10, in <module>
    nltk.download()
AttributeError: module 'nltk' has no attribute 'download'

Specs: Mac, High Sierra, Python 3.6

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

Please rename your file from nltk.py to something else, e.g. my_nltk_script.py. Then rerun the script. Please see

Also, normally you shouldn’t be downloading the NLTK data downloads in a script, unless it’s an interactive jupyter notebook or interactive interpreter.

sudo /Applications/Python\ 3.6/Install\ Certificates.command

Did the trick! I was definitely using Python 3.6. Thank you!

I named my python script nltk.py and that was causing the error. Therefore, I changed it to a different filename and voila it started working!

This worked for me. At first, I had saved a file named nltk.py and in that file, I had written those 2 lines. Go to C:\Users\User\AppData\Local\Programs\Python\Python36
In here, delete that nltk.py file.

Now, re-run those 2 lines from the cmd prompt and it’ll work.

@2hands10fingers the same problem was with me,i uninstall nltk the reinstall it again then again run those line of code. 1.pip uninstall nltk 2.pip install nltk 3.again run those lines import nltk nltk.download() 4.run it ,it will execute errorfree.

Can you try it out from an interactive console instead of a .py script? It worked for me.