Python Forum
NLTK Download Attribute error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NLTK Download Attribute error
#1
Hello all, I'm having a problem downloading NLTK. This is my first time downloading a module and I keep getting an error. I have been following https://www.youtube.com/watch?v=FLZvOKSCkxY to download NLTK on my MacBook Air. I successfully installed NLTK and I know that because when I type pip install nltk, this is the output:
Last login: Sat Jan 26 09:10:45 on ttys000
Lailas-Air:~ laila$ pip install nltk
Requirement already satisfied: nltk in /Library/Python/2.7/site-packages (3.4)
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from nltk) (1.4.1)
Requirement already satisfied: singledispatch in /Library/Python/2.7/site-packages (from nltk) (3.4.0.3)
Lailas-Air:~ laila$ 
The next step in the video was to install nltk using a file I created under idle. I created the new file and typed import nltk, but I received the following output when I ran it(this showed up in idle, not the file):
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> 
================ RESTART: /Users/laila/Documents/nltk now.py ================
Traceback (most recent call last):
  File "/Users/laila/Documents/nltk now.py", line 1, in <module>
    import nltk
  File "/Users/laila/Documents/nltk.py", line 3, in <module>
    nltk.py.download()
AttributeError: module 'nltk' has no attribute 'py'
>>>
I was supposed to receive the same output the guy in the video did at 7:03.
Reply
#2
go to the NLTK install page and follow instructions there: https://www.nltk.org/install.html
It's simple, then load corpora:
  1. open python interpreter from command line
  2. >>> import nltk
  3. >>> nltk.download()
choose and install all or some corpora
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using SHAP Library for my LSTM model - "Attribute Error" vatsalmtailor 0 2,040 Jul-13-2022, 04:34 PM
Last Post: vatsalmtailor
  error "list object has no attribute transpose()" usercat123 4 4,187 Jan-28-2022, 12:01 PM
Last Post: usercat123
  Attribute Error Raiden_Arctica 4 4,078 Mar-13-2021, 11:09 AM
Last Post: Raiden_Arctica
  Error on trying to use NLTK Punkt PythonDE 1 2,011 Oct-22-2020, 07:17 PM
Last Post: PythonDE
  Attribute error in Dataframes deshanish 1 2,371 Jul-15-2020, 08:38 AM
Last Post: snippsat
  Attribute error - Sympy VictorG8 1 4,893 Apr-09-2020, 06:03 PM
Last Post: snippsat
  [nltk] Parsing with CFG constantin01 1 2,058 Jul-05-2019, 11:11 PM
Last Post: Larz60+
  [nltk] Relations Extractor constantin01 3 3,479 Jun-28-2019, 10:41 AM
Last Post: constantin01
  [nltk] Naive Bayes Classifier constantin01 0 1,962 Jun-24-2019, 10:36 AM
Last Post: constantin01
  [split] np.arrange error - no attribute gyan 2 6,939 Aug-19-2018, 05:38 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020