installation troubles

338 views
Skip to first unread message

Gregory Allen

unread,
Jul 12, 2012, 7:32:59 PM7/12/12
to imusim...@googlegroups.com
Hi, thanks for releasing what looks to be an interesting project!

I'm trying to install v0.2 on Ubuntu 11.10 and having trouble.

This list from the installation page:
$ sudo apt-get install python-numpy python-scipy python-matplotlib \
mayavi2 ipython python-setuptools python-simpy python-pyparsing
is missing python-dev

If I use the easy_install method mentioned in the Makefile, I get:
$ sudo easy_install imusim
Processing imusim
Running setup.py -q bdist_egg --dist-dir /tmp/imusim/egg-dist-tmp-zT4ZTn
error: SandboxViolation: os.open('/home/gallen/.matplotlib/tmpgcMemZ', 131266, 384) {}

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand. Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.


When I follow the instructions:

$ python setup.py build
Mayavi should be installed first from suitable binaries.
See http://code.enthought.com/projects/mayavi/

so I modified setup.py

$ diff setup.py*
44c44
< import mayavi
---
> import enthought.mayavi

I get lots of warnings, but it builds (once I install python-dev).

$sudo python setup.py install
...
RuntimeError: '/home/gallen' is not a writable dir; you must set /home/gallen/.matplotlib to be a writable dir.

There's that problem again. I don't know if the rest of the install worked.

Now if I follow the tutorial:
$ ipython -pylab -wthread
In [1]: from imusim.all import *
...
---> 24 import imusim.maths.vectors as vectors
...
ImportError: No module named vectors

I'd love any suggestions you can provide for installation.

Also, I noticed that readme.txt and license.txt have windows line ends (full of ^M).

Thanks,
-Greg

Gregory E. Allen, PhD, Engineering Scientist
Applied Research Laboratories: The University of Texas at Austin
512-835-3487

Martin Ling

unread,
Jul 27, 2012, 9:35:46 PM7/27/12
to imusim...@googlegroups.com
Hi Gregory,

Apologies for not answering this sooner, I have been away for a while
and not keeping up with the IMUSim list.

In fact you got everything sorted out and your installation is probably
perfectly okay - you just got caught out by what I consider to be
something of a Python design flaw, at the last step:

The 'No module named vectors' message on import will occur only when you
run python from the directory you built IMUSim from. The problem is that
despite this native-code library being built and installed in the
system, Python sees the imusim source directory in the current
directory so looks there instead. Only the source code is located there,
the compiled code was built in the 'build' directory. So loading fails.

This has come up before:
https://groups.google.com/forum/#!msg/imusim-users/2bOeTbTMTec/IfFL-eGrNaAJ

To avoid the problem just change to any other directory. Or, run
setup.py build --inplace to put the compiled files in the local tree.

Your change to setup.py is already in my local tree - I've had to do
that on recent distros too so I should probably push out an update with it.

As to the problems you had running easy_install, the issue seems to be
with recent versions of Matplotlib. Importing that library now
immediately causes it to write to temporary files in the home directory.
This freaks out easy_install because it (quite reasonably) doesn't
think build scripts should be writing outside the build area.

I'm not sure what to do about that one - I'd rather not remove the
import tests from the setup.py because otherwise people will probably
just easy_install on a bare Python installation and find themselves
trying to compile the whole of numpy, scipy, etc.

I guess a hacky workaround like this one:
http://code.google.com/p/mplh5canvas/source/detail?r=32

Given all the ways there are to get stuck on installation I think I'll
see about putting some prebuilt versions on the site...


Martin

P.S. The DOS line endings are deliberate I'm afraid, for people who
download on Windows and open the readme/license in Notepad which can't
handle anything else. Unix editors can generally cope!

Gregory Allen

unread,
Aug 2, 2012, 6:50:13 PM8/2/12
to imusim...@googlegroups.com
>> 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
Reply all
Reply to author
Forward
0 new messages