Installation

You can install PyQwt on Unix/Linux and Windows.

Known problem: PyQwt requires a version of Qt with support for the class QTable. If you have a version of Qt without QTable support and want to use PyQwt, contact me: I will implement it with your help as a tester.

Installation on Unix and Linux

Prerequisites

Recent versions of the following software should be installed on your system:

  • Python. I am using version Python-2.2.2, but Python-2.2.x, Python-2.1.x and Python-2.0.x should also work. Python-1.5.2 is no longer being supported.

  • Numeric. I am using Numeric-22.0. Known problem: PyQwt does not build against Numeric-20.0.0. Upgrade, please!

  • Qt. I am using version 2.3.1, 3.0.x, and 3.1.0, but any Qt-2.x.x may work. Qt-1.45 (and earlier) are incompatible with PyQwt.

  • sip-x11-gpl-3.5.tar.gz.

  • PyQt-x11-gpl-3.5.tar.gz.

The source code for PyQwt-3.5.tar.bz2 includes the code for Qwt-20020807 and Qwt-20021013.

Build and Installation with distutils

  • The environment variable QTDIR must be set to the Qt directory containing the sub-directories bin, lib and include (installations of Qt with a non-standard directory layout are not supported by distutils).

  • Edit the assignments to the variables qt_dir, sip_program, sip_extra_dirs in the following fragment of the file setup.py:
    elif os.name == 'posix':
        sip_program = '/usr/bin/sip'
        sip_extra_dirs = ['/usr/share/sip/qt']
        extra_compile_args = [ '-fno-exceptions' ]
        doc_dir = '/usr/share/doc/PyQwt-3.5'
    These assignment are OK on my Linux systems. Edit this fragment to reflect your system:

    1. sip_program must be set, so that the the right sip executable will be called.

    2. sip_extra_dirs must be set to a list with the name of the directory containing qtmod.sip & friends.

    3. extra_compile_args must be set to a possibly empty list with extra compiler options.

  • The command python setup.py build builds the PyQwt extension.

  • Play with the *.py files in the directories examples, network and pyuic. As you can see, adapting sys.path makes PyQwt operational without installation. Do you REALLY need to install?

  • If yes, be sure not to have files of different versions of PyQwt in your Python library directory tree. How do you uninstall older versions? The first time you may have to do this manually. But, there are better ways:

    1. In case of a RPM based distribution, the command python setup.py bdist_rpm makes RPM packages in the sub-directory dist. I always uninstall an obsolete RPM package of PyQwt with the command rpm -e PyQwt before installing a new RPM package with a command like rpm -Uvh dist/PyQwt*.i586.rpm.

    2. In other cases, the command python setup.py bdist_dumb makes a "dumb" built distribution -- i.e, just an archive to be unpacked under /. If you keep the archive, you you have a trace of the installed files. Debian users may be able to convert the archive to a Debian package with alien.

  • Debugging: setup.py checks if the values of the variables are reasonable and informs you in case of failure. If so, think, and edit setup.py again. If you are really desperate, create a log with the command ./setup.py build --force >log.txt, mail log.txt to me and I will try to help.

If are not at ease using python setup.py ..., please, look at the Makefile for ideas.

Binary Installation on Windows

First, you have to install Python-2.2.2, Numeric-22.0, Qt-2.3.0-NC and PyQt-win-nc-3.5 by executing the following installation programs:

Then, you run PyQwt-3.5-Qt-NC.win32-py2.2.exe and you are set. You will find a Python22\Doc\PyQwt folder with example programs, documentation in the style of PyQt for PyQwt and the excellent documentation for Qwt.

Source Installation on Windows

Building PyQwt from source on Windows for Qt-2.3.0-NC with Microsoft Visual C++ makes use of distutils (the procedure for commercial versions of Qt is similar). If you are using another compiler, contact me, and I will help you to adapt my distutils scripts.

I advise that you bring your Python and NumPy installation up to date by executing Python-2.2.2.exe and Numeric-22.0.win32-py2.2.exe, but other recent versions may also work.

Prerequisites

In the following it is assumed that you have installed Python in C:\Python22:

  • Run QtWin230-NonCommercial.exe.

  • Unzip sip-win-nc-3.5.zip into for instance C:\MyStuff. Read the README in the sip source tree and win-sip.bat batch file in the PyQwt-3.5 sources. Use the batch file to install sip (the generated Makefile in the siplib folder to install two necessary header files is broken as off sip-3.5).

  • Unzip PyQt-win-nc-3.5.zip into for instance C:\MyStuff. Read the README in the PyQt source tree and the win-pyqt.bat batch file in the PyQwt-3.5 sources. Use the batch file to install PyQt. It builds all of PyQt and does a partial install: the documentation and examples are missing, but all the necessary library and Python files are there!

    Warning: DO NOT DO nmake install, because it deletes the necessary library files.

    Warning: the link steps are long enough for a lunch.

    Warning: to build pyuic, I have copied the source tree of zlib to C:\qt\src\3rdparty\zlib, because this is missing in QtWin230-NonCommercial.exe.

  • Unpack PyQwt-3.5.zip into for instance C:\MyStuff.

Build and Installation with distutils

  • The environment variable QTDIR must be set to the Qt directory containing the sub-directories bin, lib and include (installations of Qt with a non-standard directory layout are not supported by distutils).

  • Edit the assignments to the variable sip_extra_dirs in the following fragment of the file C:\MyStuff\PyQwt-3.5\setup.py:
    if os.name == 'nt':
        # Windows-95, -98, ...
        # My PyQwt build procedure is:
        # (1) build and install sip from source
        # (2) build and install PyQt manually from source
        # (3) build PyQwt from source
        sip_extra_dirs = ['C:\MyStuff\PyQt-3.5\sip']
        sip_program = 'sip.exe'
        extra_compile_args = []
        doc_dir = 'Doc/PyQwt-3.5'
    else:
    These assignment are OK on my Windows systems. Edit this fragment to reflect your system:

    1. sip_extra_dirs must be set to a list with the name of the directory containing qtmod.sip & friends.

    2. extra_compile_args must be set to a possibly empty list with extra compiler options.

  • The command python setup.py bdist or python setup.py bdist_wininst should make a binary distribution in the sub-directory dist.

  • Debugging: setup.py checks if the values of the variables are reasonable and informs you in case of failure. If so, think, and edit setup.py again. If you are really desperate, create a log with the command python setup.py build --force >log.txt, mail log.txt to me and I will try to help.