UserPreferences

Pyro3Installation


(!) You may want to check out PyroWhatsNew. After installing, see PyroSetUp and PyroForBeginners for site-specific changes and information.

Pyro Installation

This page documents the procedure to install Pyro. Pyro has been tested under RedHat Linux versions 7.x, 8.0, and 9. Pyro should work under any system that supports Python. To begin, you will need Python and a good compiler (gcc). On top of that, follow the instructions below, and please update this page if you have useful hints or questions. Thanks, and good luck!


To install and use Pyro, you will need all of the following:

  1. SWIG, 1.3.17 or greater [WWW]SWIG - higher versions needed for Aria; any version for other stuff, including self-organizing map and vision processing

  2. Python 2.2, or greater [WWW]Python.org

  3. Python Numeric module [WWW]Numpy - needed for image processing and neural networks. Use Numeric version 22 for Pyro 3.3.0 or less. You can use the latest and greatest Numeric (version 23) with Pyro 3.3.1 and greater.

  4. Python Image Library [WWW]PIL - for images and other displays. See notes below for version 1.1.4.

  5. Tkinter, Tk for Python (from your Red Hat RPMS. Red Hat 9 needed tkinter-*.rpm itcl-*.rpm, and tix-*.rpm) - for graphical interface. Not needed if you will run without GUI

  6. Pyro [WWW]Pyro - you need this! :)

Optional hardware and software include:

Soon, we hope to have packages for Debian (.deb) and Redhat (.rpm). However, until we do, you'll want to follow the instructions to make and install each of the different packages manually. But, we have begun to explore Debian's automatted installation tools. Jim Marshall has started a detail set of instructions for Debian: PyroInstallationDebian. Other users will probably want to follow the following install notes.

Step 0: Install Swig 1.3.17 or better

If you get an error about not finding SWIG or if your version is too low, you will need to install it. How can you tell?

% swig -version
SWIG Version 1.3.17u-20030407-1334
Copyright (c) 1995-1998
University of Utah and the Regents of the University of California
Copyright (c) 1998-2002
University of Chicago
 
Compiled with CC

If your version is less than 1.3.17, then you need to upgrade.

/!\ SWIG version 1.1 will not work! You must upgrade.

Step 1: Install Python 2.2 or better

If you already have Python 2.2 installed, go to step #2. How can you tell?

% python
Python 2.2.1 (#1, Oct 19 2001, 11:57:05) 
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-81)] on linux2
Type "copyright", "credits" or "license" for more information.
>>>

If the version number is less than 2.2, you need a more recent version. Press Control+d to exit. Sometimes python2.1 or python2.2 may be installed in addition to python1.5. Try typing python2.2 or python2.3 at the shell prompt. If the system comes back with something like command not found for both python2.2 and python2.3, then you will need to install a 2.x version of Python. Pyro has been tested with 2.2-2.3.

Download a version of Python 2 from [WWW]Python.org. Follow the installation procedure. Usually, that looks something like:

  1. su -

  2. tar xfz python-2.2.1.tgz

  3. cd python-2.2.1

  4. ./configure

  5. make

  6. make install

It is a good idea after this step to exit from the shell that you are currently running (exit or Control+d) and start a new one. For example, your LD_LIBRARY_PATH may have changed, and you need to refresh it.

Step 2: Install Numeric.py

If you already have Numeric.py installed, go to step #3. How can you tell?

$ python
Python 2.1.1 (#1, Oct 19 2001, 11:57:05) 
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-81)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import Numeric
>>>

If this gives an error, then you need to install Numeric.py. You can find Numeric at http://emergent.brynmawr.edu/~dblank/pyrobot/tars/ . Installing it looks something like:

  1. su -

  2. tar xfz Numeric-22.0.tar.gz

  3. cd Numeric-22.0

  4. python setup.py build

  5. python setup.py install

Note: You should install Numeric version 22, which includes the RandomArray module required by Con-x in Pyro version 3.3.0 and less. You can use Numeric version 23 with Pyro 3.3.1 and greater. Note: for Fedora Core 2, versions more recent than 23.1 will require updating Atlas to get lcblas.

Step 3: Install PIL

If you already have the Python Image Library installed, go to step #4. How can you tell?

$ python
Python 2.1.1 (#1, Oct 19 2001, 11:57:05) 
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-81)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import PIL
>>>

If this gives an error, then you need to install PIL. You can find PIL at http://www.pythonware.com/products/pil/index.htm. Installing it looks something like:

  1. su -

  2. tar xfz Imaging-1.1.4.tar.gz

  3. cd Imaging-1.1.4/libImaging/

  4. ./configure

  5. make

  6. cd ..

  7. python2.1 setup.py build

  8. python2.1 setup.py install

/!\ To get 1.1.4 working under Fedora Core 2:

Taking the hint from /usr/include/freetype2/freetype/freetype.h, in
_imagingft.c of the current PIL distribution replace

  #include <freetype/freetype.h>

with

 #include <ft2build.h>
 #include FT_FREETYPE_H

NOTE: For Fedora Core 2, a PIL rpm file can be obtained from http://atrpms.net/dist/fc2/PIL/.

Step # 4: Install Tkinter

The latest versions of Python may not have included Tkinter. If you get an error in Python with import Tkinter then you may need to install the tkinter-XX.rpm, itcl-XX.rpm and tix-XX.rpm files as well.

Note: For Fedora Core 2 use "yum install tkinter".

Step #5: Install Pyro

Once the above have been installed, you are ready to setup the environment and make the Pyro C-based modules. You can find the latest Pyro installation files at: http://emergent.brynmawr.edu/~dblank/pyrobot/tars/ and select the highest numbered file.

Next, put the Pyro tar file where you will install the system:

% su -
% mv pyro-X.X.tgz /usr/local/
% cd /usr/local

Untar the system, and change to that directory:

% tar xfz pyro-X.X.tgz
% cd pyro

Now you are ready to build Pyro.

NOTE: you must build Pyro in the location that it will be installed. If you move it, you will need to remake it (make clean; make).

Now, simply run 'make' in the root of the pyro subdirectory:

% make

The first step in the process is to define some variables. Answer the questions as they are posed. The answers will be stored in the file Makefile.cfg. You can run the config options again by running "python configure.py". This will run automatically the first time when you run make. For example:

$ make

---------------------------------------------------------------------
This is the configure.py script for installing Pyro, Python Robotics.
Pressing ENTER by itself will accept the default (shown in brackets).
---------------------------------------------------------------------

What version of Python do you want to build Pyro for?
(Leave empty if your Python binary is just "python")
If you need to type 'python2.2' to run Python, then
enter "2.2".

-----------------------
1. Python version number?
[]: 2.2
 -----------------------
2. Where are Python's include files?
[/usr/local/include/python2.2]: 
 -----------------------
3. Where is Python's binary?
[/usr/local/bin/python2.2]: 
 -----------------------
4. Where is Saphira? (Type 'none' if you don't have it)
[/usr/local/saphira/ver62]: 
 -----------------------
5. Where is the X11 include directory?
[/usr/X11]: 
 
Configuration is complete!

You just created Makefile.cfg. You can run this again, or edit
Makefile.cfg by hand if you need to.

Now you are ready to run 'make'

Although you don't need to right now, you can also run "make clean", and "mkdir tars; make tar".

Step #6: Testing the Installation

Now let's run the program. First, we need to set some environment variables. The following examples are given in the form assuming a bash-style console. If you use tcsh or another shell, you may have to use the "setenv VAR=value" format. Put some or all of the following (depending on what you have installed) in your $HOME/.bashrc file.

export PYTHONSTARTUP=$HOME/.python                          # Needed for some nice features (history in Python)

If you will be running Saphira or Aria, then you also need to set these:

export SAPHIRA=/usr/local/saphira/ver62/                    # Needed if you run the Pioneer robots
export SAPHIRA_COMPIPE=/tmp/$USER                           # Needed if you run the Pioneer robots
export ARIA=/usr/local/Aria                                 # Needed for Saphira 8.0
export PATH=$PATH:/usr/local/Aria/bin                       # Needed for Saphira 8.0

All done!

You can now run Pyro with the command:

% cd pyro
% bin/pyro

or put pyrobot/bin in your path and just call pyro.

You should see a window appear, with no error messages.

Optional: Python Command-line History

If you would like a nice command-line history in Python, put the following in your /home/YOURNAME/.python file:

import os, readline
histfile = os.path.join(os.environ["HOME"], ".pyhist")
try:
    readline.read_history_file(histfile)
except IOError:
    pass
import atexit
atexit.register(readline.write_history_file, histfile)
#readline.parse_and_bind("tab: complete") 
del os, histfile, readline

and export PYTHONSTARTUP=~/.python.

See PyroSetUp for further site customizations. That's it for installation! Have fun!

Trouble Shooting

What are some common problems people might have? Put your question or hint here. Thanks!

Version considerations:

  1. At the [WWW]PyRo Tar Page there are only old versions of player/stage/gazebo available. It seems that the new versions aren't yet supported. When is this planned?

The next planned version of Pyro (Pyro Version 4.0) is schedule to be ready around March, 2005. It is planned to have an upgraded interface, refactored internals to make some functions "more Pythonic", be compatible with the latest Player/Stage/Gazebo, work with Sony's AIBO, and have versions for Windows and Macintosh.

Additional Notes:

        export LD_LIBRARY_PATH=/usr/local/lib

Multiuser Robocup-Type Events

Here is an easy project: build a Gazebo or Stage world with as many robots as you have students. Start it on the server. Each student is assigned a port (or you could make robot.py files for each student with the port/hostname already defined). Then each would connect onto the server. You could:

  1. Play soccer

  2. Race to see who grabs the most pucks

  3. Play tag (if your bumpers fire, your out)

  4. Indy 500 racing

One issue with this is that you will need to be able to access each machine. If you have a firewall up, here is how to poke some holes in it. You need to edit /etc/sysconfig/iptables by adding the appropriate lines:

In RedHat 9.0, add:

-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 6665:6765 --syn -j ACCEPT

In Fedora Core 2, add:

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 6665:6765 --syn -j ACCEPT

Related topics:

  1. PyroInstallation . . . . 1 match