NLTK (Natural Language Toolkit): Download function hangs

Problem

The nltk.download() command freezes / hangs.

Reason

The nltk.download() command opens an interactive NLTK download window, which uses the Tk interactive GUI backend.

In contrast, Canopy, by default, uses the Qt interactive GUI backend. Two different interactive GUI backends cannot coexist in a single process, so they conflict and the program freezes or mis-behaves.

Solutions

1) In Canopy's Preferences dialog (Python tab),  change the PyLab backend from Interactive (Qt4) to Inline (SVG), which does not include an interactive backend, so will not conflict with Tk.

or 2) From the same Preferences dialog, disable Pylab mode (so no interactive backend has been started).

or 3) Ensure that Canopy is your default Python in a Terminal or Command Prompt window (If you are on Windows, the easiest way to do this is just to go to the Start Menu and open a "Canopy Command Prompt" window). Then start ipython from the prompt (not in pylab mode, so no interactive backend), and run  nltk.download() .

Have more questions? Submit a request

Comments

  • Avatar
    Adrian Murphy

    Thanks Jonathan, resolved my issue!

Powered by Zendesk