[Tutor] NLTK needs YAML?

Michael Scharf mnshtb at gmail.com
Sat Apr 24 07:13:13 CEST 2010


Dear Friends,

I'm new to the list, and new to Python.  The last time I've tried
anything like the below was 20 years ago on a NeXT machine, and I had
no clue what I was doing then, either.

I've gotten IDLE up and have done some hello worlding.

I am now trying to get the NLTK working on my new iMac running OS X
10.6.3.  The Python version I have up is 2.6.5.  (There may be a
slightly older pre-install with faulty IDLE lingering somewhere on the
machine.)

I've installed Macports, and through it I installed NLTK by saying

$ sudo port install nltk

which worked.

But when, in a Python session, I try to

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

is what I get.

Macports says if that happens that I should

$ cd /tmp/nltk-installer

which works.  And that I should then

$ sudo python setup.py install

Traceback (most recent call last):
  File "setup.py", line 13, in <module>
    import nltk
  File "/private/tmp/nltk-installer/nltk/__init__.py", line 92, in <module>
    from yamltags import *
  File "/private/tmp/nltk-installer/nltk/yamltags.py", line 1, in <module>
    import yaml
ImportError: No module named yaml

So I did this:

$ port search yaml

And got:

libyaml @0.1.3 (devel)
    A YAML Parser.

p5-data-phrasebook-loader-yaml @0.09 (perl)
    Abstract your queries ... with YAML!

p5-test-yaml-meta @0.15 (perl)
    Validation of the META.yml file in a distribution.

p5-test-yaml-valid @0.04 (perl)
    Test for valid YAML

p5-yaml @0.68 (perl)
    YAML loader/dumper module

p5-yaml-libyaml @0.32 (perl)
    Perl YAML Serialization using XS and libyaml

p5-yaml-syck @0.99 (perl)
    A fast, lightweight YAML loader and dumper

p5-yaml-tiny @1.41 (perl)
    Read/Write YAML files with as little code as possible

py-yaml @3.05 (python, devel)
    YAML 1.1 parser and emitter for Python

py25-yaml @3.08 (python, devel)
    YAML 1.1 parser and emitter for Python

py26-yaml @3.08 (python, devel)
    YAML 1.1 parser and emitter for Python

rb-bee @0.5.1 (ruby, devel)
    Bee is a build tool running YAML files

syck @0.55 (textproc, devel)
    An extension for reading and writing YAML

yaml-mode.el @0.0.3 (editors)
    An emacs major mode for editing yaml files.

Found 14 ports.

So I then did:

$ sudo port install py26-yaml
--->  Computing dependencies for py26-yaml
--->  Cleaning py26-yaml

closed and re-opened the terminal, and tried it all again.

But I still get the same

ImportError: No module named yaml

So my question is: do I really not have what I need here?  Or is it a
question of  something not finding something that's there?  Maybe I'm
using the wrong name somewhere?  Or??

Many thanks,
Mike S.


More information about the Tutor mailing list