We wish to completely automate installation of OpenVisualizer. The work in SW-98 provides a standardized setup.py-based install for OpenVisualizer itself. However, we must extend this standardization to OpenVisualizer's dependencies. The pip installer provides dependency management for Python-based modules, and this page documents how we intend to use pip to implement SW-74.
As we show below, pip itself usually is not sufficient for a completely automated installation. However, it provides a level of automation that is good enough for our present purposes.
In addition, core Python recently has decided to adopt pip as the primary installation mechanism for modules. So, we plan to use the setuptools module, on which pip is based, for the standard tree-based install. This approach provides for a simpler installation in the common case, and we can use pip to install OpenVisualizer itself. At the same time, we plan to retain use of the distutils module for native OS installation, which setuptools does not support.
The OpenVisualizer Confluence page lists the required modules. Some modules are Python based, and some are not. This section provides a detailed review.
Python based modules
For all platforms, OpenVisualizer requires these Python-based modules:
- pyserial – mote communication
- PyDispatcher – event framework
- bottle – web application framework
Python itself may be required. Windows does not provide Python, and some Linux distributions include Python more or less by default, depending on how the distribution is installed.
Windows adds other requirements:
- PyWin32 – Windows extensions for Python
- TAP for Windows – TUN/TAP local IP interface
In addition, any platform may need a USB serial driver, for example FTDI for TelosB. This requirement is as much a firmware issue as a software issue.
Complete Automation on Windows
So, if pip cannot completely automate installation of OpenVisualizer, let's look at the option to provide a completely automated installation. There are two popular open source packages:
There is a setup.py extension, bdist_nsi, to create an NSIS-based Windows installer. There also is documentation on how to include a nested installer, which is required (I think) for PyWin32 and TAP for WIndows. We could use bdist_nsi to create the initial script, extend it for PyWin32 and TAP, and then create the installer.
There is a similar setup.py extension, python-innosetup, for InnoSetup.
We do not plan to pursue a separate installer, for the reasons below:
- An installer seems well suited to an end-user GUI application. It would be more appropriate once we have a desktop Web UI, particularly for simulation.
- Our users are pretty technical, and the requirement to install PyWin32 and TAP is not onerous.
- I have never used these installers, and don't know how much work is required. In contrast, we already have created the source distribution via setup.py, and addition of the pip requirements file is small and simple.
Given the state of Python package installation tools, we likely will get to a desktop UI installer, but not just yet. It's a process.
If we don't use a traditional installer program, we must rely on Python's installation tools. Historically the distutils module provided this capability; however, core Python is switching to use of pip and the setuptools module upon which it is based for Python 3.4. A recent LWN article, Rationalizing Python packaging, describes the roadmap. Also see the Python Packaging User Guide and setuptools documentation.
Use of pip and setuptools means that if they are installed, the user may install OpenVisualizer and its Python dependencies with a single command, either pip-based or setup.py-based. Eventually, pip and setuptools will be included with Python, so the user will not be required to install them manually.
Also, we can use setuptools to read the existing 'requirements.pip' file to determine the modules dependencies to install.
However, setuptools does not support installation to arbitrary directories, which is useful for native setup, particularly for embedded Linux use. For example, Debian uses distutils to generate its Python module packages. Therefore, we plan to retain use of distutils for nativeSetup.py.
For a setuptools/pip installation, the user follows these steps:
- User reads Confluence instructions for installation.
- If necessary, user installs pip and setuptools.
- User chooses pip-based install or downloads the OpenVisualizer sdist source archive.
For pip install, user enters:
> pip install openVisualizer
For setup.py install, user performs these steps:
- Downloads the OpenVisualizer sdist archive, either from the Confluence wiki or Pypi.
- Extracts the archive.
> python setup.py install
Better install/requirements documentation
- A separate page for this documentation may be worthwhile to remove the clutter of the dependencies table on the main page.
- The table of requirements should be segmented into runtime vs. development, where development includes SCons, yappi, etc. Alternatively, we may wish to create a separate development page for OpenVisualizer to house these requirements.
We plan to add any necessary required Python modules to the existing, top-level requirements.pip. This file can be copied to the software/openvisualizer directory for archive creation.
Support for upgrades
pip supports package upgrades. See the usage page. In contrast, installation via setup.py does not support upgrades. Depending on the changes in the upgrade, the user may be required to manually uninstall the current version.