Archive

Posts Tagged ‘Python’

python_select is deprecated (in MacPorts)

July 7, 2011 1 comment

After some head banging with MacPorts in order to try to install python_select, I’ve found an explanation why python_select, although being displayed as being installed and active by MacPorts, still does not get installed in /opt/local/bin (and therefore, it borks when trying to run it from the command line): #29531 (_select ports no longer provide _select binary) – MacPorts.

So now it seems that python_select was deprecated and we should use instead (e.g. to select python2.6):

% sudo port select python python26

Advertisements

Install python MySQL (MySQLdb) in Mac OS X Snow Leopard 10.6

October 29, 2009 Leave a comment
Categories: Development, Mac, Python Tags: , ,

Building 64bit NumPy/SciPy/PyLab on Snow Leopard

September 10, 2009 Leave a comment

OSX: Getting Cmake to use a custom python framework

So I’m using a different python install from the one provided OEM in OSX by Apple. Specifically, I’m using Fink to get a more recent version of python 2.5 (but it could be MacPorts – the following problem would be the same).

Having python and swig installed in my osx box (both from Fink), I’m now trying to build the Marsyas library with python bindings, by means of swig, so that it becomes a python module I can use when coding in… er… python ;-).

The problem is that Cmake, when looking for the python installs and dependencies in my OSX box  (which it does when I activated the WITH_SWIG flag in Marsyas CMake build configuration), only looks for the python install provided by Apple in OSX (which is in fact a “framework” (in Apple sense) and not a library) and doesn’t know a thing about the Fink installed python (which lives in /sw/bin).

The result (and problem) is that if I start python (from Fink) and do “import marsyas”, it returns an error because that module was not in fact installed for it (it was installed for the Apple OEM python install, which I don’t want to use).

I found this blog where someone had a similar problem using Opencv ad Python and kind of fixed it, but I don’t find the proposed solution elegant and I’m still looking for less hacky fix to this issue.

Any suggestions?

Categories: Development, Mac, Marsyas, Python Tags: , , , ,

OSX: Python and friends (from Fink)

So I finally found the time (and need!) to properly install Python in my OSX10.5.6 box, together with some nice modules I’ll need for some of my current research/development work. I’ve followed a quite instructional site (see it here and here) on how to do it, but for Marsyas you’ll only need the following modules:

  • python2.5 (from Fink, and not the one provided by Apple in OSX, which is a kind of old and hard to manage version of python)
  • iPython2.5
  • scipy-py25
  • scipy-core-py25 (aka NumPy)
  • matplotlib-py25

After you install all the modules (go grab a coffee because they will take a substantial amount of time to build!),  you still need to make sure you call the Fink’s installed python and not the OSX OEM python install (you can ask OSX which python is currently being used in the terminal with “$ which python”). Fink installs python at /sw/bin/python2.5, so in order call it from anywhere you should update you .bash_profile with:

export PATH=/sw/bin:$PATH

This way, you can call python2.5 from anywhere (the same applies to any other Fink installed tool). If you want to drop the 2.5 part, just create a symbolic link to python2.5 in /sw/bin, like this:

$ cd /sw/bin

$ ln -s python2.5 python

And that’s it!

I’ll now move on to play with Marsyas and SWIG (which gets installed for you by Fink when installing the modules above) and probably report back here in case I find any troubles/tips.

Categories: Mac, Marsyas, Python Tags: , , , ,