Install numpy in Mac PS 10.4.11

112 views
Skip to first unread message

CorpusLin

unread,
May 11, 2009, 6:28:50 PM5/11/09
to nltk-users
I had no problem installing nltk, numpy, and matplotlib in Windows XP,
but am struggling to install numpy and matplotlib in Mac OS 10.4.11. I
have Python 2.5.4 installed on my Mac. When I try "python setup.py
build" within the unpacked numpy folder (usr/temp/numpy), I'm told
it's the wrong file:

$ cd numpy
$ ls
COMPATIBILITY add_newdocs.pyo matlib.pyo
DEV_README.txt core numarray
INSTALL.txt ctypeslib.py oldnumeric
LICENSE.txt ctypeslib.pyc random
README.txt ctypeslib.pyo setup.py
THANKS.txt distutils setup.pyc
__config__.py doc setup.pyo
__config__.pyc dual.py setupscons.py
__config__.pyo dual.pyc setupscons.pyc
__init__.py dual.pyo setupscons.pyo
__init__.pyc f2py site.cfg.example
__init__.pyo fft testing
_import_tools.py lib tests
_import_tools.pyc linalg version.py
_import_tools.pyo ma version.pyc
add_newdocs.py matlib.py version.pyo
add_newdocs.pyc matlib.pyc
$ python setup.py build
This is the wrong setup.py file to run
$

Can someone tell me what the *right* file is or what command I should
be using to install numpy? Or is there a special directory I should be
in? I guess you are supposed to be a lot more sophisticated about Mac
OS systems than I am to use nltk on a Mac...

Any help appreciated, so that I can progress to doing dispersion plots
etc. in Python on my Mac.

John

Steven Bird

unread,
May 12, 2009, 1:11:40 AM5/12/09
to nltk-...@googlegroups.com
2009/5/12 CorpusLin <johnne...@gmail.com>:

>
> I had no problem installing nltk, numpy, and matplotlib in Windows XP,
> but am struggling to install numpy and matplotlib in Mac OS 10.4.11. I
> have Python 2.5.4 installed on my Mac. When I try "python setup.py
> build"

How about trying to download a dmg file for 10.4 so you don't have to
build it? You'll find these for numpy and matplotlib here:

http://pythonmac.org/packages/py24-fat/dmg/

-Steven Bird

CorpusLin

unread,
May 12, 2009, 6:31:26 PM5/12/09
to nltk-users
Thanks, Steven. I did this, after installing Python 2.4, instead of
2.5. So now I have just Python 2.4 on my Mac OS 10.4.11. Now I find I
can't seem to even import nltk, which I managed to do a couple of days
ago. I get the following:

IDLE 1.1.4
>>> import nltk

Warning (from warnings module):
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/nltk/sem/__init__.py", line 24
warnings.warn("nltk.sem.relextract and nltk.sem.chat80 modules not
"
UserWarning: nltk.sem.relextract and nltk.sem.chat80 modules not
loaded (please install sqlite3 library

Traceback (most recent call last):
File "<pyshell#0>", line 1, in -toplevel-
import nltk
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/nltk/__init__.py", line 92, in -toplevel-
from yamltags import *
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/nltk/yamltags.py", line 1, in -toplevel-
import yaml
ImportError: No module named yaml
>>>

So, parts are still missing? I'm thinking I need to be a whole lot
smarter about about working in Terminal and building and installing
than I am. I also spotted this on the internet in another forum called
Logomacy, in reference to nltk, dated November 6 2007:

"I’ve successfully installed it and got it to run some of the examples
(including the graphing demo) on my Windows box and my Mac OS X
laptop. As is unfortunately typical, although it seems to run better
on the Mac, installing it on Windows was actually a quite a bit
easier. Yeah, yeah, pre-compiled binaries are the work of the devil,
but for Joe end-user–even for a relatively sophisticated Joe end-user–
it’s a pain to get partway through, realize that it won’t compile
because it’s missing some compilers, have to go get the developer
toolkit and install that, and then get back to building the thing you
were trying to get to work in the first place. I didn’t have any
particular problems, other than the time it took to download 183 mb of
stuff that I’ll probably barely use, but it was pretty painful
compared to double-clicking on an exe and then clicking a couple of
buttons. I’m sure hard-core Mac users are so used to the pain that
they don’t even perceive it as pain, and I’m certainly not saying that
the developers of the NLTK ought to devote any time at all to
improving the installation, but if you’re thinking of playing with
this and you aren’t a hard-core Mac user, I’d suggest that if you have
access to both kinds of system, at least to get your feet wet you
should try it in Windows first. You’ll be messing around with the
actual NLTK code a lot faster."

This wasn't exactly encouraging. I think I just have to live with my
failure with my efforts on my Mac and I feel I would be wasting your
time asking for even more help with this . I have Parallels installed
on my Mac and it just seems so much more straightforward to install
and use nltk in Windows XP on my Mac.

John

On May 11, 11:11 pm, Steven Bird <stevenbi...@gmail.com> wrote:
> 2009/5/12 CorpusLin <johnnewma...@gmail.com>:

anand j

unread,
May 12, 2009, 7:48:53 PM5/12/09
to nltk-...@googlegroups.com
Hey CorpusLin:
                  These are all very well known pains, when trying out code originally built on one OS on any other.. Of course it helps if you know the OS better.......
But look at the brighter side, once and if you get through building/installing NLTK on Mac once you will have understood both NLTK and Mac better..... Of course to get a quick getting the feet wet, windows is better.... :D

Cheers, all the best,

==============================================
Anand J
Center for Behaviour and Cognitive Sciences
University of Allahabad
Allahabad-211002
http://sites.google.com/a/cbcs.ac.in/students/anand
==============================================
The man who is really serious,
with the urge to find out what truth is,
has no style at all. He lives only in what is.
                 ~Bruce Lee

Sangeetha

unread,
May 13, 2009, 10:33:31 AM5/13/09
to nltk-users
Hello john

I too faced a similar problem. It took me weeks of staring into
darkness before the light really shone.

So start point
sqlite3 needs tcl i suppose
So when i installed tcl my system failed to recognize it.
I am using Fedora 10 that comes with an inbuilt Python 2.5.
Now tcl and tk are configured with this Python 2.5.

in fc9, the fedora people hacked into tcl and tk to make it work.
So if u install a new tcl or tk it wont work.
I had hard configured my system with Python 2.4, after realising this
i reinstalled my system.
So my default fc10 had Python 2.5.
Then I created an alternate installation of Python 2.4

Then I downloaded the code of nltk once again and sqlite didnt show
any problems.

So currently I have two versions of Python running on my computer

So what was the default installation of Python on your system?

Regards
Sangeetha

CorpusLin

unread,
May 13, 2009, 3:00:49 PM5/13/09
to nltk-users
Hi Sangeetha

The default Python in my Mac OS 10.4.11 was 2.3. I now have 2.5.4,
after experimenting also with 2.4. I did get to a point where I could
successfully import nltk into Python a few days ago, but I can't even
get back to this stage any more. It's pretty embarrassing when I can't
even import nltk!

I know the nltk homepage advises "If unable to "import nltk" after
installing, do cd /tmp/nltk-installer; sudo python setup.py install -
this issue arises if the NLTK installer could not locate a suitable
version of Python on your machine, or if you have more than one
version installed)", but I don't know how to proceed here. I don't
have any file/directory called "nltk-installer".

John

CorpusLin

unread,
May 13, 2009, 3:34:19 PM5/13/09
to nltk-users
OK, I've managed to get back to (almost) being able to "import nltk",
understanding "nltk-installer" to be the unpacked "nltk" directory
which does indeed contain a setup.py file.

Now I get

>>> import nltk

Warning (from warnings module):
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/nltk/app/__init__.py", line 46
warnings.warn("nltk.app.wordfreq not loaded "
UserWarning: nltk.app.wordfreq not loaded (requires the pylab
library).
>>>

So it seems I need pylab. But I never managed to get beyond this
point...

John

On May 13, 8:33 am, Sangeetha <sangeetha.sekha...@gmail.com> wrote:

Sangeetha

unread,
May 14, 2009, 12:38:54 AM5/14/09
to nltk-users
Hi John
Once u entered as sudo user or root no need to type "sudo python
setup.py install"
Its enough to do "python setup.py install"

Sangeetha

Steven Bird

unread,
May 14, 2009, 4:10:36 AM5/14/09
to nltk-...@googlegroups.com
2009/5/14 CorpusLin <johnne...@gmail.com>:

> Now I get
>
>>>> import nltk
>
> Warning (from warnings module):
>  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/nltk/app/__init__.py", line 46
>    warnings.warn("nltk.app.wordfreq not loaded "
> UserWarning: nltk.app.wordfreq not loaded (requires the pylab
> library).
>>>>
>
> So it seems I need pylab. But I never managed to get beyond this
> point...

This was a warning, not an error. (Perhaps we shouldn't even print
this warning.) Its just saying you won't be able to use modules that
depend on pylab, which isn't many. So just ignore that warning and
continue...

-Steven Bird

CorpusLin

unread,
May 15, 2009, 11:55:29 AM5/15/09
to nltk-users
I think I'll just settle for what I have been able to get to work on
my mac (nltk, numpy, but no pylab library), following Steven's advice,
and wait and hope that one day there will be some straightforward way
of getting everything to work on a mac without me having to do a
computer science degree first. I *do* like the visualizations that
plots bring, though (e.g., in a dispersion plot). In some cases, I can
tabulate data in python and then bring the results into R for
plotting.

As I say, working in Windows XP, I just followed instructions on the
nltk download page and everything needed for nltk seemed to be up and
running in no time. It's because I am planning to introduce students
to nltk that I felt I needed to familiarize myself with how you
install it on a Mac. If the instructor can't even install everything
correctly, it doesn't do much for the instructor's credibility...

John

On May 14, 2:10 am, Steven Bird <stevenbi...@gmail.com> wrote:
> 2009/5/14 CorpusLin <johnnewma...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages