Annoying warning on load

253 views
Skip to first unread message

Edward Grefenstette

unread,
May 20, 2009, 11:35:25 PM5/20/09
to nltk-users
Perhaps someone more technically able than me (which can't be that
rare) can explain this, because it's driving me nuts.

Every time I load nltk the following happens (cut and paste from my
terminal):
=======
>>> import nltk
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/nltk-0.9.9-py2.6.egg/nltk/app/__init__.py:46: UserWarning:
nltk.app.wordfreq not loaded (requires the pylab library).
warnings.warn("nltk.app.wordfreq not loaded "
>>>
=======

I'm running OS X 10.5.7 with Python 2.6.2.
Has anyone else encountered this and knows how to fix it?
Is anyone capable of helping troubleshoot this?
Many thanks in advance for any assistance!

Best,
Edward

Steven Bird

unread,
May 20, 2009, 11:59:07 PM5/20/09
to nltk-...@googlegroups.com
2009/5/21 Edward Grefenstette <egr...@gmail.com>:

>
> Perhaps someone more technically able than me (which can't be that
> rare) can explain this, because it's driving me nuts.

Sorry about that. I guess we'll need to fail silently when packages
are missing. Hmmm...

Here's a way to get rid of the warning. After importing nltk, type
"nltk.app.__path__" to find the location of the NLTK applications
folder. Find that folder on your hard drive and edit the file
"__init__.py". Where you see:

try:
import pylab
except ImportError:
import warnings
warnings.warn("nltk.app.wordfreq not loaded "
"(requires the pylab library).")

Replace the last 3 lines with "pass", i.e.:

try:
import pylab
except ImportError:
pass

Take care to get the indentation right.

We'll fix this for the next release.

-Steven Bird

Edward Grefenstette

unread,
May 21, 2009, 12:11:58 AM5/21/09
to nltk-users
Cheers Steven, that worked like a charm.

Best,
Edward

On May 21, 4:59 am, Steven Bird <stevenbi...@gmail.com> wrote:
> 2009/5/21 Edward Grefenstette <egre...@gmail.com>:

joshua verano

unread,
May 24, 2009, 10:22:22 AM5/24/09
to nltk-...@googlegroups.com
This happened to me too. i just downloaded the matlibplot ang numpy
and since then it gives no error
Reply all
Reply to author
Forward
0 new messages