MacPython and NumPy problem

Discussion in 'Mac Apps and Mac App Store' started by Mac Lad, Dec 16, 2004.

  1. Mac Lad macrumors member

    Joined:
    Sep 25, 2004
    Location:
    Big Easy, Louisiana
    #1
    Hi guys,

    I am attempting to learn Python for some scientific applications. I successfully installed MacPython 2.3 which includes the PackageManager, IDE, and Launcher. Now... I need to use some kind of computational tool, so I also downloaded Numeric Python (NumPy) 23.6 source code from sourceforge.net, but the problem is... how do I install NumPy (or how do I compile it)?? I tried running the setup.py thorough Launcher but it fails to work. Do I need to download Xcode or something to build source codes? Is there some command I need to use in the Terminal?

    Please please help me... I don't even know the difference between binaries and source. Any help would be really appreciated. By the way, I'm using a PowerBook G4 with 10.3.6 .

    Thanx a bunch!
    Mac Lad :confused:
     
  2. Loge macrumors 68020

    Loge

    Joined:
    Jun 24, 2004
    Location:
    England
    #2
    The setup is run from within Python, so I think at the terminal you need something like -

    python setup.py install

    I think a version comes with MacPython, that you can get from the Package Manager.

    Also, unless you have a specific reason to use numpy, you should consider using numarray instead, since that is the future direction of the numeric Python programming effort.

    Finally, the numeric extensions enhance Python significantly, if you need computation stuff, so they are well worth it. Enjoy!
     
  3. MisterMe macrumors G4

    MisterMe

    Joined:
    Jul 17, 2002
    Location:
    USA
    #3
    You know that Python is including with MacO X 10.2 or later, don't you? However, you ought to make sure it is Python 2.3. If not, you should upgrade.
     
  4. Loge macrumors 68020

    Loge

    Joined:
    Jun 24, 2004
    Location:
    England
    #4
    MacPython uses the Python built into OS X and adds additional tools. In particular, a numerical module is not included in the version of Python that ships with OS X.
     
  5. Mac Lad thread starter macrumors member

    Joined:
    Sep 25, 2004
    Location:
    Big Easy, Louisiana
    #5
    Thanx for the replies! I'll definitely get the numarray as well. Unfortunately, I'm still encountering problem. I went to the directory where the NumPy source folder is located (which is the Desktop in my case). Then, when I typed "python setup.py install" (w/out the quotes), I got this message:

    unable to execute gcc: No such file or directory
    error: command 'gcc' failed with exit status 1

    I wonder what this implies..... Loge, I'm not sure what you mean by "running it inside Python" Do I need to launch Python or MacPython first or do I just use the Terminal? I'm sorry .... I'm so unfamiliar with this kind of thing.... :(...

    Thanx once more
     
  6. Loge macrumors 68020

    Loge

    Joined:
    Jun 24, 2004
    Location:
    England
    #6
    From the error message you describe, it looks like it is looking for the gcc compiler which is a part of the Apple developer tools (xcode). You can either download the latest from Apple website, or (since it's a large download) you're probably okay to install the version that shipped with your computer (I think it is to be found in Applications/Installers/Xcode Tools). Just double click on the file Developer.mkpg to install the tools.

    The numeric modules for python have some parts coded in C for efficiency; that's why you need the compiler installed.

    As I said you run numpy setup from within python. You can just run

    python setup.py install

    from Terminal, which loads python and runs the script all in one statement. Hope this helps. It's a while since I used it, but it can be done.

    :)
     
  7. Mac Lad thread starter macrumors member

    Joined:
    Sep 25, 2004
    Location:
    Big Easy, Louisiana

Share This Page