>> I'm trying to install v0.2 on Ubuntu 11.10 and having trouble.
I've also been away. It's that time of year. :)
I've learned that Ubuntu 11.10 has (old) SimPy 1.8-1, and that's too old for imusim. It build and installs, but fails on "from imusim.all import *" with:
SimPy.Simulation.Simulation
AttributeError: 'module' object has no attribute 'Simulation'
I was able to proceed by downloading and installing SimPy 2.2 (from
sf.net) and removing the Ubuntu packages (sudo apt-get remove python-simpy). The new Ubuntu 12.04 LTS has a newer SimPy, but I'm not ready for that big of a change. :)
Next it trips up where you import enthought.*, which seems to be limited to the visualization directory. I'm assuming that's because you're using the EPD. I much prefer to use the built-in package manager.
I made some minor patches and I can now run the "Getting Started" tutorial section on Ubuntu 11.10 (with a manually installed SimPy 2.2)
d7c9800869cb imusim/visualisation/rendering.py
--- a/imusim/visualisation/rendering.py Tue Jul 31 17:09:36 2012 -0500
+++ b/imusim/visualisation/rendering.py Thu Aug 02 17:29:07 2012 -0500
@@ -21,12 +21,18 @@
import time
import wx
import numpy as np
-from enthought.mayavi import mlab
from abc import ABCMeta, abstractmethod
-from enthought.traits.api import HasTraits, Button, Range
-from enthought.traits.ui.api import View, Group, Item
import imusim.maths.vectors as vectors
+try:
+ from enthought.mayavi import mlab
+ from enthought.traits.api import HasTraits, Button, Range
+ from enthought.traits.ui.api import View, Group, Item
+except ImportError:
+ from mayavi import mlab
+ from traits.api import HasTraits, Button, Range
+ from traitsui.api import View, Group, Item
+
class InteractiveAnimation(HasTraits):
"""
Animator that renders in the WxWidgets main loop, using idle events.
diff -r d7c9800869cb imusim/visualisation/video.py
--- a/imusim/visualisation/video.py Tue Jul 31 17:09:36 2012 -0500
+++ b/imusim/visualisation/video.py Thu Aug 02 17:29:07 2012 -0500
@@ -20,7 +20,10 @@
import numpy as np
from imusim.visualisation.rendering import AnimatedRenderer
-from enthought.mayavi import mlab
+try:
+ from enthought.mayavi import mlab
+except ImportError:
+ from mayavi import mlab
import tempfile
import os
import subprocess
I also had to change setup.py to import mayavi instead of enthought.mayavi
The way setup.py tries to import various packages seems unusual to me. Why not use:
setup_requires = ["numpy", "scipy", "matplotlib", "mayavi", "SimPy", "pyparsing" ],
install_requires = ["numpy", "scipy", "matplotlib", "mayavi", "SimPy", "pyparsing" ],
If a package is missing you'll throw a DistutilsError. If you want to print where to find the package, you could (in the exception handler):
if 'numpy' in str(ex):
print "numpy must be installed, see
http://numpy.scipy.org/"
Now that I've got simpy installed and apparently working, I'll try to ask some *real* questions. :)
Thanks,
-Greg