Enthought Python Distribution (EPD) update via command line

Since the enpkg command doesn’t currently provide a good automatic way to update all your installed packages via command line, here’s a great way to update all the packages already installed in your Enthought Python Distribution (EPD) installation:


Run this command, after you have added this function code to your ~/.bash_profile, or in ~/.bashrc file:

function epd_update ()
    echo "[ Checking for epd package updates... ]"
    #-- display new packages
    sudo enpkg --whats-new
    #-- save new package list
    sudo enpkg --whats-new > /tmp/enpkgnew.txt
    #-- save only the first word after the "=====", it will be "no" if there are no new packages to be updated
    firstword=$(sed '1,2d' /tmp/enpkgnew.txt | awk 'NR>1{exit};1' | awk '{print $1}')
    if [ "$firstword" == "no" ]; then
        echo "[ No package updates available, exiting ]"
        echo "[ Updating... ]"
        #-- space delimited list of the new packages
        newpacks=$(sed '1,2d' /tmp/enpkgnew.txt | awk '{print $1}' | tr "\n" " ")
        #-- update the new packages
        sudo enpkg $newpacks

It will either exit if there are no new packages, or will systematically install all new ones. Enjoy!

Eclipse with Aptana plugin and SFTP support, a free website editor

A friend wanted a good, free web development IDE for Mac. Personally, I use Coda and love it, but it’s not free.

I found this resource as a starting point.

I quickly found that although KompoZer and Nvu were good for her because they were WYSIWYG editors, they both don’t support SFTP, which was required in this case (and most cases really), and were also lacking a little love. SeaMonkey and the rest below that on the list were either too simple or too complex. For me, this left three: Aptana, Komodo Edit, or Eclipse to try.

The Komodo Editor is actually pretty good, but I felt didn’t have a very good remote connection tool. Aptana doesn’t officially support SFTP without paying $99/yr (I tried using their free SFTP plugin, but it didn’t work in Eclipse 3.4.2). So, since I use Eclipse for my Python projects, I wanted to see if I could get Eclipse with the Aptana plugin to work. I found this blog with the answer.

These are the shortened steps I followed:

  1. Download and install the Eclipse SDK ver. 3.4.2 (Ganymede)
  2. Install the Aptana Studio as an Eclipse plugin
  3. In the Aptana Perspective, ‘My Aptana’ tab, select ‘Plugins’ at the top, then choose to install ‘Aptana PHP’.
  4. Using the Eclipse Software Updates, install a new remote site, Remote System Explorer, by adding this URL: http://download.eclipse.org/dsdp/tm/updates/, but you only need to select the ‘Remote System Explorer Core’ and ‘RSE SSH Services’ portions, found under the ‘RSE_Runtime’ when selecting features to install.
  5. Now, with the Remote System Explorer perspective selected (top right of the IDE), on the left side, in the Remote Systems tab, right-click and choose ‘New Connection…’, then input the settings to connect to your remote webserver.
  6. perspective


  7. Once you’ve logged into your site and see the files, right-click on the one(s) to edit and choose ‘Open With’, then ‘Aptana PHP Editor’
  8. You can now edit with all the syntactic highlighting, auto complete and other features of Aptana Studio.

libtiff error in Matlab when attempting to use ImageMagick

Trying to use the Imagemagick toolbox (for me, installed via MacPorts) sometimes doesn’t work (for example, converting a png image) in Matlab because Matlab for some reason uses the libraries in its path over those given in system call (this is for Mac, but probably for *nix and maybe even Windows).

This is an example call:

[s,w] = system([IMAGEMAGICK_PATH,'convert ',pwd,'/',outfile,'.png -rotate 90 ',pwd,'/',outfile,'.png']);

This is the error:

dyld: Library not loaded: /opt/local/lib/libtiff.3.dylib
Referenced from: /opt/local/bin/convert
Reason: Incompatible library version: convert requires version 12.0.0 or later, but libtiff.3.dylib provides version 11.0.0

The work around is to replace the Matlab library with the ImageMagick one (only need to do this once and will stay until you upgrade Matlab):

cd /Applications/MATLAB74/bin/maci/   (or wherever your Matlab is installed)
mv libtiff.3.7.1.dylib  libtiff.3.7.1.dylib.MATLAB  (give it a different name)
ln -s /opt/local/lib/libtiff.3.dylib libtiff.3.7.1.dylib  (create a soft link to the Imagemagick library file)

EDIT: This is the much better way to handle this:

setenv('DYLD_LIBRARY_PATH',['/opt/local/lib/:' getenv('DYLD_LIBRARY_PATH')])

Serial Port communications on Mac via Matlab

I have a rev B (Core 2 Duo from Dec, 2006) Apple MacBook Pro laptop running Leopard OS X (version 10.5.2) and have Matlab version (R2007b). I’ve just found that I can NOT use the built-in serial port object, instead, I get the following error:

 java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver
??? Error using ==> serial.serial at 57
The serial port object is supported on the Solaris, 32-bit Windows and 32-bit Linux platforms only.

So, to get it successfully working, I downloaded these files: SerialComm.m, SerialComm.mexmac and SerialComm.mexmaci from http://svn.berlios.de/svnroot/repos/osxptb/stable/Psychtoolbox/PsychHardware/.

You can then use code like this:

 PORT = 1;
% close (if previously open)
SerialComm( 'close', PORT)
% open
% flush the buffers
SerialComm( 'purge', PORT)
% status
SerialComm( 'status', PORT)
% read
STR = SerialComm( 'readl', PORT);
% close
SerialComm( 'close', PORT)

[UPDATE 02 Apr, 2008]: Note, this same code didn’t seem to work on a recently purchased Macbook. Good luck.

[UPDATE 27 Mar, 2009]: I see that in Matlab version 7.8.0 (R2009a) if you go to ‘serial’ in Help docs it now says for Mac OS X and Mac OS X 64 you can use serial(‘/dev/tty.KeySerial1’); I don’t have a way of testing that right now, but it’s possible that you don’t need to use this third party toolkit anymore. If that’s true, please leave a note here.

Installing odcctools on Leopard

Instructions for installing odcctools in Mac OS X 10.5 Leopard (on Intel Macbook Pro Core 2 Duo) via macports:

I was attempting to get matplotlib, the python plotting library, installed via macports and the first problem is that the library is dependent on odcctools (20061117_0), which fails to build in the x86_64 environment.

But, we can get it to build…:

1) (clean the slate)

$sudo port -v selfupdate;sudo portindex
$sudo port clean --all odcctools

2) (this part will fail)

$sudo port install odcctools


--->  Fetching odcctools
--->  Verifying checksum(s) for odcctools
--->  Extracting odcctools
--->  Configuring odcctools
--->  Building odcctools with target default
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_odcctools/work/odcctools/odcctools" && make default " returned error 2
Command output: cd libstuff && make
/usr/bin/gcc-4.0 -Wall -Wno-long-double -Wno-import  -DHAVE_CONFIG_H   -I/opt/local/include -I../include -I../include   -O2 -fno-builtin-round -fno-builtin-trunc -no-cpp-precomp -mdynamic-no-pic  -c -o allocate.o allocate.c
In file included from ../include/libkern/OSByteOrder.h:70,
from ../include/mach/ndr.h:94,
from ../include/mach/clock_priv.h:7,
from ../include/mach/mach_interface.h:37,
from ../include/mach/mach.h:62,
from allocate.c:26:
../include/libkern/machine/OSByteOrder.h:45: error: redefinition of '_OSSwapInt16'
/usr/include/libkern/i386/_OSByteOrder.h:49: error: previous definition of '_OSSwapInt16' was here
../include/libkern/machine/OSByteOrder.h:54: error: redefinition of '_OSSwapInt32'
/usr/include/libkern/i386/_OSByteOrder.h:58: error: previous definition of '_OSSwapInt32' was here
../include/libkern/machine/OSByteOrder.h:63: error: redefinition of '_OSSwapInt64'
/usr/include/libkern/i386/_OSByteOrder.h:69: error: previous definition of '_OSSwapInt64' was here
make[1]: *** [allocate.o] Error 1
make: *** [libstuff] Error 2
Error: Status 1 encountered during processing.

(hint from http://code.google.com/p/iphone-dev/issues/detail?id=106#c1 )
From this path,
in each subdirectory, look for a “Makefile”. IF the file has a “MYINCLUDES” line, add this after the equals ( = ) sign:
“-isysroot /Developer/SDKs/MacOSX10.4u.sdk” (w/o quotes). If the Makefile doesn’t contain a line which starts with MYINCLUDES, then ignore it.

e.g. This is how the line will look after putting in:

MYINCLUDES = -isysroot /Developer/SDKs/MacOSX10.4u.sdk -I$(builddir) -I$(srcdir) -I$(top_builddir)/include \
-I$(top_srcdir)/include $(INCPRIVEXT) $(FORHDRS)

4) (continue installation)

$sudo port install odcctools


--->  Building odcctools with target default
--->  Staging odcctools into destroot
--->  Installing odcctools 20061117_0
--->  Activating odcctools 20061117_0
--->  Cleaning odcctools


Next, I tried to continue the installation of matplotlib (e.g. sudo port install py25-matplotlib ), but <sigh> now g95 won’t compile…

[UPDATE 22 Sat, 2007: py25-matplotlib, including g25 now installs via Macports!!]

Newsyland blog starts!

Newsyland blog starts today.

Yes, the world is treated to yet another blog.  I have wanted to have a blog for some time now, to share, give back if you will, things I have learned – some internet wisdom and some of my own discoveries.  I spent some time looking at CMS software and wanted to do something based in Python since I’m learning it, but since my web provider (1and1.com) only supports version 2.2.1 (yes, a version over 4 years old, and yes I asked for a newer version but was shot down), I decided instead on the ubiquitous WordPress.

I’m an oceanographer in California, where I use Matlab and build websites, so will hopefully pass on nuggets of wisdom regarding Matlab, Javascript, PHP and CSS. I’m also a recent and enthusiastic Mac OS X convert, but dabble in Linux (Fedora) and am a Windows power user, so these subjects may come up. I’m also learning python and planning on taking some of the O’Reilly on-line classes, so will probably post some things about them too.

Oh, and “newsyland” is, I hope, a witty homophone to New Zealand – a place I’d love to live some day…

Filed under About