Skip to content

Commit 55c2ab5

Browse files
committed
Document bundled static builds and system library overrides
1 parent 8037991 commit 55c2ab5

1 file changed

Lines changed: 28 additions & 26 deletions

File tree

‎README.md‎

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,24 @@ conda install -c conda-forge ta-lib
6565

6666
### Dependencies 🧩
6767

68-
To use TA-Lib for python, you need to have the [TA-Lib](http://ta-lib.org)
69-
already installed. You should probably follow their [installation
70-
directions](https://ta-lib.org/install/) for your platform, but some
71-
suggestions are included below for reference.
68+
Binary wheels include the [TA-Lib](http://ta-lib.org) C library and do not
69+
require a compiler or a separate TA-Lib C installation.
70+
71+
Starting with version 0.8.3, source builds download the pinned TA-Lib C 0.8.1
72+
release, verify its checksum, and build and statically link it into the Python
73+
extension. This requires network access, a C compiler and CMake. On Windows,
74+
source builds require the Microsoft C++ Build Tools. CMake is installed
75+
automatically when using pip's default build isolation.
76+
77+
To use an existing TA-Lib C installation instead, set ``TA_INCLUDE_PATH`` or
78+
``TA_LIBRARY_PATH`` before building. Setting either variable disables the
79+
bundled C build, including its download; if only one is set, the other uses
80+
the standard search paths. These variables accept multiple directories
81+
separated by ``os.pathsep`` (``:`` on Unix, ``;`` on Windows). They apply to
82+
source builds, not prebuilt wheels.
83+
84+
The following instructions are for installing your own TA-Lib C library.
85+
You can also follow its [installation directions](https://ta-lib.org/install/).
7286

7387
> Some Conda Forge users have reported success installing the underlying TA-Lib C
7488
> library using [the libta-lib package](https://anaconda.org/conda-forge/libta-lib):
@@ -91,7 +105,7 @@ for your architecture:
91105
arch -arm64 brew install ta-lib
92106
```
93107

94-
And perhaps you can set these before installing with `pip`:
108+
To link a source build against the Homebrew installation, set:
95109

96110
```shell
97111
export TA_INCLUDE_PATH="$(brew --prefix ta-lib)/include"
@@ -143,7 +157,8 @@ fail with ``No such file or directory`` errors.
143157
For convenience, and starting with version 0.6.5, we now build binary wheels
144158
for different operating systems, architectures, and Python versions using
145159
GitHub Actions which include the underlying TA-Lib C library and are easy to
146-
install.
160+
install. Starting with version 0.8.3, this library is statically linked into
161+
the extension.
147162

148163
Supported platforms:
149164

@@ -173,28 +188,15 @@ using the instructions above.
173188

174189
### Troubleshooting 🛠️
175190

176-
If you get a warning that looks like this:
177-
178-
```shell
179-
setup.py:79: UserWarning: Cannot find ta-lib library, installation may fail.
180-
warnings.warn('Cannot find ta-lib library, installation may fail.')
181-
```
182-
183-
This typically means `setup.py` can't find the underlying `TA-Lib`
184-
library, a dependency which needs to be installed.
185-
186-
---
187-
188191
If you installed the underlying `TA-Lib` library with a custom prefix
189192
(e.g., with `./configure --prefix=$PREFIX`), then when you go to install
190-
this python wrapper you can specify additional search paths to find the
191-
library and include files for the underlying `TA-Lib` library using the
192-
`TA_LIBRARY_PATH` and `TA_INCLUDE_PATH` environment variables:
193+
this Python wrapper you can select that installation instead of the bundled
194+
build using the `TA_LIBRARY_PATH` and `TA_INCLUDE_PATH` environment variables:
193195

194196
```shell
195197
export TA_LIBRARY_PATH=$PREFIX/lib
196198
export TA_INCLUDE_PATH=$PREFIX/include
197-
python setup.py install # or pip install ta-lib
199+
python -m pip install --no-binary=TA-Lib TA-Lib
198200
```
199201

200202
---
@@ -218,10 +220,10 @@ common.obj : error LNK2001: unresolved external symbol TA_GetUnstablePeriod
218220
common.obj : error LNK2001: unresolved external symbol TA_GetVersionString
219221
```
220222

221-
This typically means that it can't find the underlying `TA-Lib` library, a
222-
dependency which needs to be installed. On Windows, this could be caused by
223-
installing the 32-bit binary distribution of the underlying `TA-Lib` library,
224-
but trying to use it with 64-bit Python.
223+
When using ``TA_INCLUDE_PATH`` or ``TA_LIBRARY_PATH``, check that they point
224+
to the headers and libraries of a compatible TA-Lib C installation. On Windows,
225+
the library architecture must match Python (for example, a 64-bit Python needs
226+
a 64-bit TA-Lib C library).
225227

226228
---
227229

0 commit comments

Comments
 (0)