Issue 527 in nltk: Installing NLTK on Mac

21 views
Skip to first unread message

nl...@googlecode.com

unread,
Mar 14, 2010, 6:19:21 PM3/14/10
to nltk-...@googlegroups.com
Status: New
Owner: StevenBird1
Labels: Type-Installation

New issue 527 by StevenBird1: Installing NLTK on Mac
http://code.google.com/p/nltk/issues/detail?id=527

Please update this ticket with any problems relating to installation of
NLTK on Macintosh computers.

OS version: 10.?.?
NLTK version:
Python version

What problem did you encounter with installation?

Did you find any fixes? Please suggest ways to improve our installation
instructions.


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

nl...@googlecode.com

unread,
Mar 14, 2010, 8:39:57 PM3/14/10
to nltk-...@googlegroups.com

Comment #1 on issue 527 by johnnewman00: Installing NLTK on Mac
http://code.google.com/p/nltk/issues/detail?id=527

Hi Steven

Mac OS 10.4.11
Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Macports installed


john-newmans-computer:~ johnnewman$ sudo port install py26-nltk
Password:
---> Computing dependencies for py26-nltk
---> Building tk
Error: Target org.macports.build returned: shell command " cd
"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_x11_tk/
work/tk8.5.8/unix" && /usr/bin/make -j2 all " returned error 2
etc etc etc
Error: The following dependencies failed to build: tk
Error: Status 1 encountered during processing.

In Python 2.5.4
>>> import nltk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named nltk

John

nl...@googlecode.com

unread,
Mar 14, 2010, 8:46:09 PM3/14/10
to nltk-...@googlegroups.com

Comment #2 on issue 527 by StevenBird1: Installing NLTK on Mac
http://code.google.com/p/nltk/issues/detail?id=527

Since you have Python 2.5, please install py25-nltk, not py26-nltk.

nl...@googlecode.com

unread,
Mar 15, 2010, 10:30:05 AM3/15/10
to nltk-...@googlegroups.com

Comment #3 on issue 527 by johnnewman00: Installing NLTK on Mac
http://code.google.com/p/nltk/issues/detail?id=527

Results with py25-nltk:

john-newmans-computer:~ johnnewman$ python


Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

john-newmans-computer:~ johnnewman$ sudo port install py25-nltk
---> Computing dependencies for py25-nltk


---> Building tk
Error: Target org.macports.build returned: shell command " cd
"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_x11_tk/work/tk8.5.8/unix"
&&
/usr/bin/make -j2 all "
returned error 2

.....many such lines...
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_x11_tk/work/tk8.5.8/unix/../generic/tk3d.c:1373:
error:
parse error before ')' token
make: *** [tkArgv.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [tk3d.o] Error 1

Error: The following dependencies failed to build: py25-matplotlib
py25-configobj python25 tk py25-dateutil py25-setuptools py25-tz py25-numpy
atlas
gcc43 gmp mpfr gzip py25-nose py25-pyobjc-cocoa py25-pyobjc py25-py2app
py25-altgraph py25-bdist_mpkg py25-macholib py25-modulegraph py25-
pyobjc2 py25-pyobjc2-cocoa py25-yaml


Error: Status 1 encountered during processing.

Before reporting a bug, first run the command again with the -d flag to get
complete output.

nl...@googlecode.com

unread,
May 31, 2010, 3:56:27 PM5/31/10
to nltk-...@googlegroups.com

Comment #4 on issue 527 by steven.mccauley: Installing NLTK on Mac
http://code.google.com/p/nltk/issues/detail?id=527

Howdy-

I performed a manual installation of NLTK on a Mac, which supposedly went
through successfully. When I go
to "import nltk" either through IDLE or the command line, though, no module
is detected. Any advice is much
appreciated.

(In the manual installation, I'm installing NLTK straight to the general
hard disk. Does it need to go somewhere
else, i.e. the python folder?)

Thanks-
Steve

nl...@googlecode.com

unread,
May 31, 2010, 6:05:00 PM5/31/10
to nltk-...@googlegroups.com
Updates:
Status: Accepted

Comment #5 on issue 527 by StevenBird1: Installing NLTK on Mac
http://code.google.com/p/nltk/issues/detail?id=527

You probably have two versions of Python, with NLTK installed in one of
them, while you're using the other one.
Please see the thread on nltk-users for suggestions for what to do:

http://groups.google.com/group/nltk-users/browse_thread/thread/e14b647243ca5b66


nl...@googlecode.com

unread,
Nov 17, 2011, 11:29:36 PM11/17/11
to nltk-...@googlegroups.com

Comment #6 on issue 527 by robinse...@gmail.com: Installing NLTK on Mac
http://code.google.com/p/nltk/issues/detail?id=527

Hi,

I have the same problem: I installed MacPorts and NLTK (using "sudo port
install python26"), but the importation fails:

IDLE 2.6.1
>>> import nltk

Traceback (most recent call last):

File "<pyshell#0>", line 1, in <module>
import nltk


ImportError: No module named nltk


Many thanks in advance for your help!


Robin

nl...@googlecode.com

unread,
Mar 19, 2013, 4:00:02 PM3/19/13
to nltk-...@googlegroups.com

Comment #8 on issue 527 by alifargh...@gmail.com: Installing NLTK on Mac
http://code.google.com/p/nltk/issues/detail?id=527

I imported nltk on my windows machine easily but when I switched to Mac OS
10.8.3 it was very painful.

I installed MacPort, command line tools and finally was able to install
nltk and its dependencies on python 2.7.2 but when i try to import nltk
from python, that is what I get:

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



I have been working on this for hours with no success. Any advice is
appreciated.
Ali Farghaly

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

nl...@googlecode.com

unread,
Apr 10, 2013, 8:10:00 AM4/10/13
to nltk-...@googlegroups.com

Comment #9 on issue 527 by andres.s...@gmail.com: Installing NLTK on Mac
http://code.google.com/p/nltk/issues/detail?id=527

Hi
I named a file token.py and tried to run it and got an error. Then I
realize that it was a bad file name and changed it, but it gets me error
anyway.
Traceback (most recent call last):
File "mitoken.py", line 1, in <module>
from nltk.book import *

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nltk/__init__.py",
line 105, in <module>
from collocations import *

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nltk/collocations.py",
line 37, in <module>
from nltk.util import ingrams

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nltk/util.py",
line 12, in <module>
import pydoc

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pydoc.py",
line 55, in <module>
import sys, imp, os, re, types, inspect, __builtin__, pkgutil

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py",
line 39, in <module>
import tokenize

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tokenize.py",
line 38, in <module>
COMMENT = N_TOKENS
NameError: name 'N_TOKENS' is not defined
What can I do?
Regards
soto_...@yahoo.com
Reply all
Reply to author
Forward
0 new messages