0

Disclaimer: I know a similar question has already been asked but the solution didn't work and the question was regarding 'nltk.download()' whereas I'm using 'nltk.download(popular)'.

I have Python 64 and 32 bit on my Windows 10 32-bit. I'm currently running my program on the 64-bit Python 3.6.4 (my program works better on the 64-bit due to more memory space).

I've installed all the packages I had on the 32 bit to the 64 bit. I then ran my program and received the following error:

File "C:\Users\name\AppData\Local\Programs\Python\Python36\lib\site-packages\nltk\classify\maxent.py", line 78, in

nltk.download('popular')

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

I reinstalled and upgraded nltk as many times as I could yet nothing works!

Below is the entire code relating to nltk import:

from nltk import compat
from nltk.data import gzip_open_unicode
from nltk.util import OrderedDict
from nltk.probability import DictionaryProbDist

from nltk.classify.api import ClassifierI
from nltk.classify.util import CutoffChecker, accuracy, log_likelihood
from nltk.classify.megam import (call_megam,
                                 write_megam_file, parse_megam_weights)
from nltk.classify.tadm import call_tadm, write_tadm_file, parse_tadm_weights
import nltk
nltk.download('popular')

I've also tried moving around the import nltk along with the nltk.download() and it didn't help.

Any solutions please?

EDIT: Also, this shouldn't be marked as a duplicate because the solutions of the other question do not work. I believe this problem is different and requires a different solution.

TheRealG
  • 11
  • 5
  • 2
    Is your own file named `nltk.py`, by any chance? The parameter doesn't make any difference, the code isn't getting as far as that. – jonrsharpe Jan 02 '18 at 16:46
  • @jonrsharpe unless he has all the above : compat, data, util, probability, ClassifierI exc. the error would be at the import no? – Moshe Slavin Jan 02 '18 at 16:49
  • @MosheSlavin that's a good point, but the answers on the other post give some other options. – jonrsharpe Jan 02 '18 at 16:51
  • @jonrsharpe Hey, I'm testing on a program called 'TestA.py' and trying to fix the error in 'maxent.py'. There's no file on my system called nltk.py – TheRealG Jan 02 '18 at 16:59
  • Try to add this before the call to `nltk.download`: `print(nltk.__file__)`. The path that it outputs should point to the NLTK library and not elsewhere... if this fails try also `print(open(nltk.__file__).read())` and check that the contents of said files are intact. – Bakuriu Jan 02 '18 at 18:35
  • @Bakuriu can you make this an answer please? Turns out I get the following error `NameError: name 'nltk' is not defined`. While it doesn't solve the problem, it gives me some hint. Thanks. – TheRealG Jan 02 '18 at 18:41
  • *"the solutions of the other question do not work"* - then describe precisely what you did and what *"do not work"* actually means. – jonrsharpe Jan 03 '18 at 10:23
  • @jonrsharpe I followed the instructions in the other solutions (the solutions provided in the question you marked as a duplicate of). And the instructions did not make any changes in the error I was receiving, meaning the problem was not solved by applying those instructions. – TheRealG Jan 03 '18 at 13:56
  • Then [edit] the question to *actually say that*, along with the result of the other debugging you now say you've tried. – jonrsharpe Jan 03 '18 at 13:56
  • @jonrsharpe No, you can leave it marked as duplicate. – TheRealG Jan 03 '18 at 14:00

0 Answers0