Python Implementation¶
Supported Interpreters¶
Python 2.x
Dependencies¶
Required Dependencies
Python development tools
setuptools
Python implementation of Google protocol buffers
Optional Dependencies
Installation of Dependencies on Debian-based Systems¶
$ sudo apt-get python-setuptools python-dev python-protobuf
Installation of Dependencies on MacOS using Homebrew¶
For installing RSB and its dependencies from source on Darwin, we recommend to use Homebrew, an easy-to-use package manager for MacOS.
$ brew install cmake boost protobuf
Installation of Dependencies on Windows Systems¶
Install Microsoft Visual Studio. If you are planning to use the Python implementation of RSB, only version 2008 currently works.
In order to install Spread a source-based installation is required. The visual studio solution for Spread 4.2 is currently broken. Hence only version 4.1 can be used.
In detail, perform the following steps:
Open
spread.slnin thewin32folder of the spread archive with Visual Studio.Set the active configuration to
release.Build
libspreadandspread. If you build the whole solution errors might appear. However, only the aforementioned artifacts are required.Optionally, manually copy the generated
.liband.exeto an installation prefix.
Python can be installed using the binary installer. A 32 bit version is recommended.
Installation¶
Clone RSB and its immediate dependencies from the git repository
- RSC
“1.0” branch of https://code.cor-lab.de/git/rsc.git
- RSB Protocol
“1.0” branch of https://github.com/open-rsx/rsb-protocol
- RSB Python
“1.0” branch of https://github.com/open-rsx/rsb-python
Install RSC and the RSB protocol definitions as described in the C++ installation instructions.
Create and edit
setup.cfgSee also
- Setuptools Documentation
Documentation of the format of the
setup.cfgfile
Setuptools does not use command line arguments to configure projects. Instead a file called
setup.cfgin the project root is used.Add or replace
protocolrootin section[proto]with the path to the RSB protocol files (e.g.protocolroot=PREFIX/share/rsbprotocol). An exemplarysetup.cfgfile could look like this:# [existing content here] [proto] protocolroot=/your/prefix/share/rsbprotocol
Note
The following RSB-specific options are recognized:
protocin section[proto]The Google protocol buffers protoc compiler used to generate code from the RSB protocol description. If not specified
PATHis used.formatin section[doc]Either
htmlorpdffor the API documentation generation.verbosein section[doc]Bool flag to control verbose output of the generation tool epydoc.
Start building and installation
$ export PYTHONPATH=
PREFIX/lib/python2.VERSION/site-packages # if you are install to /usr or /usr/local it must be dist-packages $ python setup.py build $ python setup.py install --prefix=PREFIX
Adding Support for Spread¶
Install Spread as described in the C++ installation instructions.
Installation of the Spread module for Python¶
Warning
The Spread Python version automatically installed by setuptools is not working.
Download sources from http://www.spread.org/files/SpreadModule-1.5spread4.tgz.
Extract the downloaded archive file and change to the
SpreadModule-1.5spread4directoryEdit
setup.pyand setSPREAD_DIRto your installation prefix (e.g.,/usr,/your/prefixorc:\code\spread)Note
On Windows it might also be necessary to change the following aspects of the
setup.py:include_dirs = [SPREAD_DIR + r"\include"], library_dirs = [SPREAD_DIR + r"\lib\win32"], libraries = ['libspread', 'wsock32'], # comment out #extra_link_args = ['/NODEFAULTLIB:libcmt'],
Build and install
$ python setup.py build_ext --rpath
PREFIX/lib $ python setup.py install --prefix=PREFIXNote
It might be that the
--rpathoption needs to be removed on Windows.
Testing the Installation¶
See also
- Invoking the Interpreter
How to configure and start the Python interpreter.
The following statement should succeed in a python shell:
import rsb
Note
It may be necessary to set PYTHONPATH to
PREFIX/lib/python2.X/site-packages as in the installation
step above.