| 1 |
.. default-role:: literal |
| 2 |
|
| 3 |
================================ |
| 4 |
Installation of multiprocessing |
| 5 |
================================ |
| 6 |
|
| 7 |
Versions earlier than Python 2.4 are not supported. If you are using |
| 8 |
Python 2.4 then you must install the `ctypes` package (which comes |
| 9 |
automatically with Python 2.5). Users of Python 2.4 on Windows |
| 10 |
also need to install the `pywin32` package. |
| 11 |
|
| 12 |
On Unix It's highly recommended to use Python 2.5.3 (not yet released) or |
| 13 |
apply the ``fork-thread-patch-2`` patch from `Issue 1683 |
| 14 |
https://bugs.python.org/issue1683`_. |
| 15 |
|
| 16 |
Windows binary builds for Python 2.4 and Python 2.5 are available at |
| 17 |
|
| 18 |
https://pypi.org/project/multiprocessing/ |
| 19 |
|
| 20 |
Python 2.6 and newer versions already come with multiprocessing. Although |
| 21 |
the stand alone variant of the multiprocessing package is kept compatible |
| 22 |
with 2.6, you mustn't install it with Python 2.6. |
| 23 |
|
| 24 |
Otherwise, if you have the correct C compiler setup then the source |
| 25 |
distribution can be installed the usual way:: |
| 26 |
|
| 27 |
python setup.py install |
| 28 |
|
| 29 |
It should not be necessary to do any editing of `setup.py` if you are |
| 30 |
using Windows, macOS or Linux. On other unices it may be necessary |
| 31 |
to modify the values of the `macros` dictionary or `libraries` list. |
| 32 |
The section to modify reads :: |
| 33 |
|
| 34 |
else: |
| 35 |
macros = dict( |
| 36 |
HAVE_SEM_OPEN=1, |
| 37 |
HAVE_SEM_TIMEDWAIT=1, |
| 38 |
HAVE_FD_TRANSFER=1 |
| 39 |
) |
| 40 |
libraries = ['rt'] |
| 41 |
|
| 42 |
More details can be found in the comments in `setup.py`. |
| 43 |
|
| 44 |
Note that if you use `HAVE_SEM_OPEN=0` then support for posix |
| 45 |
semaphores will not been compiled in, and then many of the functions |
| 46 |
in the `processing` namespace like `Lock()`, `Queue()` or will not be |
| 47 |
available. However, one can still create a manager using `manager = |
| 48 |
processing.Manager()` and then do `lock = manager.Lock()` etc. |
| 49 |
|
| 50 |
|
| 51 |
Running tests |
| 52 |
------------- |
| 53 |
|
| 54 |
To run the test scripts using Python 2.5 do :: |
| 55 |
|
| 56 |
python -m multiprocessing.tests |
| 57 |
|
| 58 |
and on Python 2.4 do :: |
| 59 |
|
| 60 |
python -c "from multiprocessing.tests import main; main()" |
| 61 |
|
| 62 |
The sources also come with a Makefile. To run the unit tests with the |
| 63 |
Makefile using Python 2.5 do :: |
| 64 |
|
| 65 |
make test |
| 66 |
|
| 67 |
using another version of Python do :: |
| 68 |
|
| 69 |
make test PYTHON=python2.4 |
| 70 |
|
| 71 |
This will run a number of test scripts using both processes and threads. |
| 72 |
|
| 73 |
|
| 74 |
Running examples |
| 75 |
---------------- |
| 76 |
|
| 77 |
The make target `examples` runs several example scripts. |
| 78 |
|
| 79 |
|
| 80 |
Building docs |
| 81 |
------------- |
| 82 |
|
| 83 |
To build the standalone documentation you need Sphinx 0.5 and setuptools |
| 84 |
0.6c9 or newer. Both are available at https://pypi.org/. With |
| 85 |
setuptools installed, do :: |
| 86 |
|
| 87 |
sudo easy_install-2.5 "Sphinx>=0.5" |
| 88 |
make doc |
| 89 |
|
| 90 |
The docs end up in ``build/sphinx/builder_name``. |