I am running Enthought Canopy 64-bit Version 1.1.1.1452 on OSX 10.9. I am trying to get the Enthought Canopy package "chaco 4.3.0-3" up and running for 2D interactive plotting. However, even the simplest chaco demos raise an error. From the stack trace, it looks as though It looks like the problem is related to loading fonts.
I am following the quick-start instructions here:
http://docs.enthought.com/chaco/quickstart.html
However, when I try to run the simple_line.py demo, I get the following error:
Last login: Mon Dec 2 15:20:35 on ttys000
dnab434def:demo mike$ pwd
/Users/mike/Library/Enthought/Canopy_64bit/User/Examples/chaco-4.2.0/demo
dnab434def:demo mike$ python
Enthought Canopy Python 2.7.3 | 64-bit | (default, Aug 8 2013, 05:37:06)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
dnab434def:demo mike$ python simple_line.py
Traceback (most recent call last):
File "simple_line.py", line 24, in <module>
from enable.api import Component, ComponentEditor
File "/Users/mike/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/enable/api.py", line 8, in <module>
from base import IDroppedOnHandler, TOP, VCENTER, BOTTOM, LEFT, HCENTER, RIGHT, \
File "/Users/mike/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/enable/base.py", line 31, in <module>
from kiva.constants import DEFAULT, DECORATIVE, ROMAN, SCRIPT, SWISS,\
File "/Users/mike/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/kiva/__init__.py", line 19, in <module>
from fonttools import Font
File "/Users/mike/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/kiva/fonttools/__init__.py", line 1, in <module>
from font import Font, str_to_font
File "/Users/mike/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/kiva/fonttools/font.py", line 9, in <module>
from font_manager import FontProperties, fontManager
File "/Users/mike/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/kiva/fonttools/font_manager.py", line 1400, in <module>
_rebuild()
File "/Users/mike/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/kiva/fonttools/font_manager.py", line 1350, in _rebuild
fontManager = FontManager()
File "/Users/mike/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/kiva/fonttools/font_manager.py", line 1053, in __init__
self.ttffiles = findSystemFonts(paths) + findSystemFonts()
File "/Users/mike/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/kiva/fonttools/font_manager.py", line 422, in findSystemFonts
for f in OSXInstalledFonts(fontext=fontext):
File "/Users/mike/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/kiva/fonttools/font_manager.py", line 346, in OSXInstalledFonts
files.extend(glob.glob(os.path.join(path, '*.'+ext)))
File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/glob.py", line 16, in glob
return list(iglob(pathname))
File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/glob.py", line 41, in iglob
for dirname in dirs:
File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/glob.py", line 42, in iglob
for name in glob_in_dir(dirname, basename):
File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/glob.py", line 61, in glob1
return fnmatch.filter(names, pattern)
File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/fnmatch.py", line 54, in filter
_cache[pat] = re.compile(res)
File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/re.py", line 190, in compile
return _compile(pattern, flags)
File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/re.py", line 242, in _compile
raise error, v # invalid expression
sre_constants.error: bad character range
How can I work around this?
Apparently Chaco didn't like the custom fonts I had installed. Here is the workaround that worked for me.
I moved all my fonts out of the ~/Library/Fonts folder, then I ran "from chaco.shell import *" in an IPython notebook. Now I can use Chaco as per usual.
There must be some kind of weird caching happening, because I moved all my custom fonts back into the ~/Library/Fonts folder and Chaco still works.
Anyway, hopefully this will help someone if they get the same error message.