This site requires javascript to be enabled to fuction correctly


On OSX, why is CASA crashing with references to packages that are installed externally to CASA?
Posted by Nathan Brunetti, Last modified by Nathan Brunetti on 05 March 2015 06:00 PM

Sometimes packages that are distributed within the CASA installation (such as IPython, numpy etc.) become confused with non-CASA installations upon starting or working in CASA. Error messages like

CASA Version 4.2.2 (r30986)
Compiled on: Thu 2014/09/04 14:47:49 UTC
Traceback (most recent call last):
File "/Applications/CASA.app/Contents/Resources/python/casapy.py", line 392, in <module>
from taskinit import *
File "/Applications/CASA.app/Contents/Resources/python/taskinit.py", line 1, in <module>
import pCASA
File "/Applications/CASA.app/Contents/Resources/python/pCASA.py", line 51, in <module>
import parallel_go
File "/Applications/CASA.app/Contents/Resources/python/parallel_go.py", line 1, in <module>
from IPython.kernel import client
File "/Library/Python/2.7/site-packages/ipython-0.13.1-py2.7.egg/IPython/kernel/__init__.py", line 10, in <module>
raise ImportError(__doc__)
ImportError: IPython.kernel has been replaced by IPython.parallel.

The previous version of IPython's parallel library was located at this
location (IPython.kernel). It has been moved to the IPython.parallel
subpackage and has been refactored to use zeromq/pyzmq instead of twisted.

can appear, where you can see the last file reference is a module outside the CASA directory (on OSX, the CASA.app directory). On OSX, this problem has been found to occur most commonly when a package is installed by the user with the easy_install tool. This tool automatically prepends paths to its packages to the beginning of the PYTHONPATH environment variable causing CASA to try using the external installations instead of it's own. Then if there are any version incompatibilities between the package CASA is shipped with and those installed elsewhere on a user's computer, there will likely be problems.

An internal CASA code fix for this is in the works but currently a known workaround is to modify the Python easy_install.pth file to prevent it from prepending it's directories to the PYTHONPATH variable. An example of a modified version of this file is

user@fakeMachine > pwd 
/Library/Python/2.7/site-packages

user@fakeMachine > cat easy-install.pth
#import sys; sys.__plen = len(sys.path)
./pyfits-3.0.6-py2.7-macosx-10.8-intel.egg
./pip-1.5.4-py2.7.egg
./ipython-2.0.0-py2.7.egg
./setuptools-3.4.4-py2.7.egg
#import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)

Feel free to submit questions about this workaround to the ALMA Helpdesk.

(0 vote(s))
Helpful
Not helpful

Comments (0)