Re: Teething troubles with Python on a Mac

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • greg

    #1

    Re: Teething troubles with Python on a Mac

    Thomas Philips wrote:
    Question 1: How can I locate the Python installation? There a few
    files under Applications MacPython 2.5, but this is clearly not the
    entire installation.
    Have a look in

    /Library/Frameworks/Python.framewor k/Versions/2.5
    But I do not seem to
    be able to see the sequence of folders under the horizontal scroll bar
    in any finder window. What do I need to do to make the folder sequence
    visible in all Finder Windows?
    You can't -- this feature only exists in the Search window,
    which is a different kind of window from the normal Finder
    windows.

    However, in a normal Finder window, if you click and hold
    with the Command key on the title displayed in the title
    bar at the top of the window, you'll get a pop-up menu
    showing the position of the folder you're looking at in the
    nesting hierarchy.
    Item 2. I downloaded and installed the SciPy superpack from
    Macinscience,or g. Scipy seems to import correctly into the Python
    2.5.1 that comes with the Mac, but i cannot import it into MacPython
    2.5.2.
    I'm not familiar with SciPy distributions, but if it's some
    sort of double-clickable installer, it's likely that it's only
    designed to install into the system Python (i.e. the one that
    comes installed with MacOSX).

    See if it has installed anything into

    /Library/Python/2.5/site-packages

    If so, you could try moving or copying them into

    /Library/Frameworks/Python.framewor k/Versions/2.5/lib/python2.5/site-packages
    Question 5. How can I find the current value of the PYTHONPATH
    environment variable, and how can I edit it and add a directory in
    which I keep my Python programs.
    To find out its current value, in a Terminal window,

    echo $PYTHONPATH

    To have it set each time you open a Terminal window,
    one way is to put something like this in your ~/.bashrc
    file:

    PYTHONPATH=what ever_you_want
    export PYTHONPATH

    However, because the filename starts with a dot, it
    won't show up in the Finder or any Save dialog boxes,
    making it a bit tricky to edit with a GUI-based text
    editor. There's some advice here on how to deal with
    that:

    Access to this place or content is restricted. If you think this is a mistake, please contact your administrator or the person who directed you here.

    Question 6. Apparently there's a Property List Editor that must be
    used to create a file called ~ /.MacOSX/environment.pli st. I can't
    find a directory called ~/.MacOSX. Is this a hidden directory?
    I've never tried that method myself, but it sounds
    plausible. You'll have similar difficulties with the
    name .MacOSX not showing up in the Finder. However,
    you can get to it using the "Go To Folder..." command
    under the "Go" menu in the Finder and typing in the
    full pathname.

    If there isn't already an environment.pli st file
    there, you may have to save it somewhere else first
    and then drag it into the .MacOSX folder.

    The Property List Editor comes with the Developer
    Tools and lives in /Developer/Applications/Utilities.
    Item 4. I opened a terminal window, and typed ipython. Here's what I
    got:
    >
    /Users/tom/.ipython
    WARNING:
    Installation error. IPython's directory was not found.
    It's quite likely that this will correct itself once you
    get the relevant files into the right site-packages folder.

    Also, if this is your only reason for wanting to set
    PYTHONPATH, you may not have to worry about that either.
    I never thought I'd say this, but it actually seemed a lot easier to
    get Python and any associated programs up and running on Windows! I
    suspect that a large fraction of my troubles are due to the fact that
    I am brand new to the Mac and to Unix, but I bought the Mac in part
    because I thought that using it was effortless.
    It's generally pretty smooth (although different from Windows
    in many ways, so you do need to learn some new things) as
    long as you stick to GUI-style applications. Python doesn't
    quite fit into that way of working, however. You need to
    know a bit about what's going on underneath, particularly
    when managing your own Python installation.

    The way I approach Python on MacOSX is to treat it as a
    Unix system and use the standard Python method of installing
    packages, i.e. use Python to run a setup.py file. This
    ensures that the package will be installed into whichever
    Python is being used to run the setup.py.

    Apart from the initial installation of Python itself, I
    never use an installer to install a Python package if I
    can avoid it. I wouldn't trust it to install into the right
    Python version.

    --
    Greg
  • Avi

    #2
    Re: Teething troubles with Python on a Mac

    Apart from the initial installation of Python itself, I
    never use an installer to install a Python package if I
    can avoid it. I wouldn't trust it to install into the right
    Python version.
    On that: how would I go about updating the system Python, then? Or is
    that going to be stuck at whatever it is, and Mac users are expected
    to run two simultaneous Python installations? I'm not entirely
    comfortable with having a separate MacPython (I used to do so, but it
    caused so many issues with installing new packages that I gave up on
    it) and would prefer to just update system Python.

    - Avi

    Comment

    • Timothy Grant

      #3
      Re: Teething troubles with Python on a Mac

      On Sun, Aug 3, 2008 at 12:37 AM, Avi <avinashvora@gm ail.comwrote:
      >Apart from the initial installation of Python itself, I
      >never use an installer to install a Python package if I
      >can avoid it. I wouldn't trust it to install into the right
      >Python version.
      >
      On that: how would I go about updating the system Python, then? Or is
      that going to be stuck at whatever it is, and Mac users are expected
      to run two simultaneous Python installations? I'm not entirely
      comfortable with having a separate MacPython (I used to do so, but it
      caused so many issues with installing new packages that I gave up on
      it) and would prefer to just update system Python.
      >
      - Avi
      --

      >
      You will likely cause more problems updating the system python than
      managing the two separate installations. OSX relies on the version of
      python they ship. While there are likely cases where it could be
      replaced completely safely the risks of having to re-install your OS
      at some point because it has the wrong version of python are not worth
      it.

      --
      Stand Fast,
      tjg. [Timothy Grant]

      Comment

      • Avinash Vora

        #4
        Re: Teething troubles with Python on a Mac

        You will likely cause more problems updating the system python than
        managing the two separate installations.
        That's sadly worrying.
        OSX relies on the version of python they ship.
        I think that helps my point--there *are* bug fixes between major
        versions despite the new language changes, and that can really only be
        a good thing.
        While there are likely cases where it could be
        replaced completely safely the risks of having to re-install your OS
        at some point because it has the wrong version of python are not worth
        it.

        I haven't been a Mac user long enough to see a major version change (I
        was on Linux/XP/Vista for most of 2.4 and switched distributions right
        after 2.5 came out, and then XP before that), so I've never seen a
        version change, but is this the sort of thing that will be upgraded in
        Software Update?

        - Avinash

        Comment

        • Timothy Grant

          #5
          Re: Teething troubles with Python on a Mac

          On Sun, Aug 3, 2008 at 10:44 AM, Avinash Vora <avinashvora@gm ail.comwrote:
          >You will likely cause more problems updating the system python than
          >managing the two separate installations.
          >
          That's sadly worrying.
          >
          >OSX relies on the version of python they ship.
          >
          I think that helps my point--there *are* bug fixes between major versions
          despite the new language changes, and that can really only be a good thing.
          >
          >While there are likely cases where it could be
          >replaced completely safely the risks of having to re-install your OS
          >at some point because it has the wrong version of python are not worth
          >it.
          >
          >
          I haven't been a Mac user long enough to see a major version change (I was
          on Linux/XP/Vista for most of 2.4 and switched distributions right after 2.5
          came out, and then XP before that), so I've never seen a version change, but
          is this the sort of thing that will be upgraded in Software Update?
          >
          - Avinash
          I haven't paid enough attention to the system python in my four years
          as an Apple user to know. I simply installed the python I wanted and
          went from there.

          I honestly don't think it is a cause for concern though. The situation
          is very similar to on Linux (Red Hat has their version of python) you
          simply install what you want and use it.

          --
          Stand Fast,
          tjg. [Timothy Grant]

          Comment

          • greg

            #6
            Re: Teething troubles with Python on a Mac

            Avi wrote:
            On that: how would I go about updating the system Python, then?
            The usual advice is not to try to do that at all.
            Generally it's best to treat anything in /System
            as off-limits.
            (I used to do so, but it
            caused so many issues with installing new packages that I gave up on
            it)
            I've very rarely had any problem with maintaining my
            own Python installation, but as I said, I always install
            packages using "python setup.py".

            Python itself copes very well with having multiple
            versions installed, on all platforms, but you have to
            do things the Python way.

            --
            Greg

            Comment

            • Avinash Vora

              #7
              Re: Teething troubles with Python on a Mac

              (Greg: You only sent the email to me: you probably wanted to add the
              mailing list to the recipients.)

              On Aug 4, 2008, at 8:37 AM, greg wrote:
              Avi wrote:
              >
              >On that: how would I go about updating the system Python, then?
              >
              The usual advice is not to try to do that at all.
              Generally it's best to treat anything in /System
              as off-limits.
              Right, but I meant if there is an Apple-sanctioned way. I guess not?
              >(I used to do so, but it
              >caused so many issues with installing new packages that I gave up on
              >it)
              >
              I've very rarely had any problem with maintaining my
              own Python installation, but as I said, I always install
              packages using "python setup.py".
              I guess I'll give it a shot, then. Alias in bash to MacPython, I
              assume?
              Python itself copes very well with having multiple
              versions installed, on all platforms, but you have to
              do things the Python way.
              My point was that it seems to be a bit of a hack.

              Thanks for the advice from everyone, though.

              --
              Avi

              Comment

              • Greg Ewing

                #8
                Re: Teething troubles with Python on a Mac

                Avinash Vora wrote:
                (Greg: You only sent the email to me: you probably wanted to add the
                mailing list to the recipients.)
                I replied to the newsgroup as well, so it should
                turn up in the list.
                Right, but I meant if there is an Apple-sanctioned way. I guess not?
                Not that I'm aware of.
                I guess I'll give it a shot, then. Alias in bash to MacPython, I assume?
                You'll probably find that the MacPython installer has set
                things up so that simply running "python" in the shell
                will get the version it has installed. Check the version
                number displayed in the banner when you run it.

                If it's not the right one, you could make a symlink
                from /usr/bin/python to the one you want (by default it's
                symlinked to the system python).

                --
                Greg

                Comment

                Working...