Skip to content

Commit 844f04d

Browse files
committed
add docs for long compilation
1 parent 73616e8 commit 844f04d

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Other
1313
* Refactor CASSANDRA_VERSION to a some kind of version object (PYTHON-915)
1414
* Warn users when using the deprecated Session.default_consistency_level (PYTHON-953)
1515
* Add DSE smoke test to OSS driver tests (PYTHON-894)
16+
* Document long compilation times and workarounds (PYTHON-868)
1617

1718
3.13.0
1819
======

docs/installation.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,44 @@ You can use ``pip install --pre cassandra-driver`` if you need to install a beta
2020

2121
***Note**: if intending to use optional extensions, install the `dependencies <#optional-non-python-dependencies>`_ first. The driver may need to be reinstalled if dependencies are added after the initial installation.
2222

23+
Speeding Up Installation
24+
^^^^^^^^^^^^^^^^^^^^^^^^
25+
26+
By default, installing the driver through ``pip`` uses Cython to compile
27+
certain parts of the driver.
28+
This makes those hot paths faster at runtime, but the Cython compilation
29+
process can take a long time -- as long as 10 minutes in some environments.
30+
31+
In environments where performance is less important, it may be worth it to
32+
:ref:`disable Cython as documented below <cython-extensions>`.
33+
You can also use ``CASS_DRIVER_BUILD_CONCURRENCY`` to increase the number of
34+
threads used to build the driver and any C extensions:
35+
36+
$ # installing from source
37+
$ CASS_DRIVER_BUILD_CONCURRENCY=8 python setup.py install
38+
$ # installing from pip
39+
$ CASS_DRIVER_BUILD_CONCURRENCY=8 pip install cassandra-driver
40+
41+
Finally, you can `build a wheel <https://packaging.python.org/tutorials/distributing-packages/#wheels>`_ from the driver's source and distribute that to computers
42+
that depend on it. For example:
43+
44+
$ git clone https://github.com/datastax/python-driver.git
45+
$ cd python-driver
46+
$ git checkout 3.14.0 # or other desired tag
47+
$ pip install wheel
48+
$ python setup.py bdist_wheel
49+
$ # build wheel with optional concurrency settings
50+
$ CASS_DRIVER_BUILD_CONCURRENCY=8 python setup.py bdist_wheel
51+
$ scp ./dist/cassandra_driver-3.14.0-cp27-cp27mu-linux_x86_64.whl user@host:/remote_dir
52+
53+
Then, on the remote machine or machines, simply
54+
55+
$ pip install /remote_dir/cassandra_driver-3.14.0-cp27-cp27mu-linux_x86_64.whl
56+
57+
Note that the wheel created this way is a `platform wheel
58+
<https://packaging.python.org/tutorials/distributing-packages/#platform-wheels>`_
59+
and as such will not work across platforms or architectures.
60+
2361
OSX Installation Error
2462
^^^^^^^^^^^^^^^^^^^^^^
2563
If you're installing on OSX and have XCode 5.1 installed, you may see an error like this::
@@ -123,6 +161,8 @@ On OS X, homebrew installations of Python should provide the necessary headers.
123161

124162
See :ref:`windows_build` for notes on configuring the build environment on Windows.
125163

164+
.. _cython-extensions:
165+
126166
Cython-based Extensions
127167
~~~~~~~~~~~~~~~~~~~~~~~
128168
By default, this package uses `Cython <http://cython.org/>`_ to optimize core modules and build custom extensions.

0 commit comments

Comments
 (0)