You can install PyQwt on Unix/Linux and Windows.
see the Section called Installation on Unix and Linux for installation instructions starting from source code for Unix and Linux.
see the Section called Binary Installation on Windows for instructions on the use of the binary Windows installer for the non-commercial version of Qt, Qt-2.3.0-NC.
see the Section called Source Installation on Windows for installation instructions starting from source code for Windows, MSVC and Qt-2.3.0-NC. Contact me if you need help with building PyQwt for other versions of Qt: it will require slight modification of the file pyqt_support.py.
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.
Recent versions of the following software should be installed on your system:
Python. I am using version Python-2.2.1, 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-21.3. Known problem: PyQwt does not build against Numeric-20.0.0. Upgrade, please!
Qt. I am using version 2.3.1 and 3.0.x, but any Qt-2.x.x may work. Qt-1.45 (and earlier) are incompatible with PyQwt.
The sources PyQwt-sip332_041.tar.bz2 include the sources of qwt-0.4.1.
Edit the assignments to the variables qt_dir, sip_program, sip_spec_dirs in the following fragment of the file setup.py:
else: qt_dir = '/usr/lib/qt2' sip_program = '/usr/bin/sip' sip_spec_dirs = ['/usr/share/sip/qt'] |
qt_dir 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 yet supported by distutils).
sip_program must be set to sip.exe (it is installed in the same directory as the Python interpreter).
sip_spec_dirs must be set to a list with the name of the directory containing qtmod.sip & friends.
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:
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.
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.
First, you have to install Python-2.2.1, Numeric-21.3, Qt-2.3.0-NC and PyQt-3.2.2-Qt-NC by executing the following installation programs:
Then, you run PyQwt-sip332_041-Qt-NC.win32-py2.2.exe and you are set. In your Python folder you will find a PyQwt folder with example programs and documentation in the style of PyQt. More extensive documentation is available at the home page of the Qwt library.Building PyQwt from source on Windows for Qt-2.3.0-NC with Microsoft Visual C++ makes use of distutils. If you are using another compiler or another version of Qt, 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.1.exe and Numeric-21.3.win32-py2.2.exe, but other recent versions may also work.
In the following it is assumed that you have installed Python in C:\Python22:
Run QtWin230-NonCommercial.exe. I do not have access to a professional version of Qt, but it should be easy to adapt the file pyqt_support.py for other versions of Qt. Contact me for help.
Unzip sip-3.3.2.zip into for instance C:\MyStuff. Read the README in the sip source tree, do python setup.py and nmake. This builds all of sip and installs it partially. Finish the installation by doing nmake install from the siplib folder to install the necessary header files.
Unzip PyQt-3.3.2.zip into for instance C:\MyStuff. Read the README in the PyQt source tree, do python setup.py and nmake. This builds all of PyQt and installs it partially: the documentation and examples are missing, but all the necessary library files are there! Copy manually the *.py files from the directories qt, qtcanvas, qtgl, qtnetwork, qttable and qtxml to C:\Python22\Lib\site-packages.
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-sip332_041.zip into for instance C:\MyStuff.
Edit the assignments to the variables qt_dir, sip_program, sip_incdir, sip_spec_dirs and libraries in the following fragment of the file C:\MyStuff\PyQwt-sip332_041\setup.py:
if os.name == 'nt': # Windows-95, -98, ... # My PyQwt build procedure is: # (1) build and install sip from source (see sip-3.3.2\README) # (2) build and install PyQt from source (see PyQt-3.3.2\README) # (3) build PyQwt from source qt_dir = 'C:\qt' sip_program = 'sip.exe' # by default sip is installed in C:\Python2.2. sip_spec_dirs = ['C:\MyStuff\PyQt-3.3.2\sip'] else: |
qt_dir must be set to the value displayed by the command echo %QTDIR%.
sip_program must be set to sip.exe.
sip_spec_dirs must be set to a list with the name of the directory containing qtmod.sip & friends.
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.