Unable to import nltk after successful install

13,777 views
Skip to first unread message

Bio

unread,
Jul 17, 2013, 8:49:27 AM7/17/13
to nltk-...@googlegroups.com
Hello, For the past couple of years I have been using 2 different Mac systems to run nltk. I stopped using one of the two systems about 3 months ago and was using one system exclusively. Unfortunately the system I have been using of late died and so I am now using the system I haven't used nltk on for about three months. In the past nltk has worked without problem on my one remaining system. Today when I go to write some nltk code I get an error message that says:

>>> import nltk

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import nltk
ImportError: No module named nltk

I've used nltk on this system many times in the past so I'm unclear why now it should be unable to import. The only change I have made to the system since the last time I used nltk is an upgrade to the latest version of Mac OSX.  Since I couldn't get nltk to import I thought I'd try to do a new nltk install. I did the new install and got the message that the install was successful but still nltk won't import. If anybody has any thoughts on how to verify if nltk is on my system and how to import it I would appreciate the assistance. Thanks, George

Alex Rudnick

unread,
Jul 18, 2013, 4:10:34 PM7/18/13
to nltk-...@googlegroups.com
Hey George,

If you do something like:

> import sys
> sys.path

... then you'll see where your Python is trying to load packages from
-- if nltk isn't present in any of the directories listed, then it's
not installed for your current Python version!
Hope this helps!

--
-- alexr

George Orton

unread,
Jul 18, 2013, 5:27:15 PM7/18/13
to nltk-...@googlegroups.com
Hi Alex. Thanks for your response. I did as you suggested and I do not see nltk anywhere. Which begs the question how do I re-install the nltk module on my system. I tried re-running the original nltk-2.0.1rc1.dmg file and it told me I had a successful install. But since I still couldn't import nltk after the successful install I figured I would start from scratch following the directions on nltk.org. Unfortunately the instructions on the nltk install at nltk.org seem to be out of date. They say to choose a file from  http://pypi.python.org/pypi/setuptools that is specific to the version of Python I am using. Unfortunately none of the packages on that page reference which version of Python is being used.  Thanks, George

Steven Bird

unread,
Jul 22, 2013, 6:38:09 AM7/22/13
to nltk-users
Thanks for reporting the problem. Sorry that the instructions on the
website were stale. I've updated them now, simply pointing people to
the setuptools page without further comment.

http://nltk.org/install.html

-Steven Bird
> --
> You received this message because you are subscribed to the Google Groups
> "nltk-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nltk-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages