Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
FYI: ta-lib Pre-Compiled Binary Available

This is not about Quantopian but if you are using TA-Lib (the library) via ta-lib (the Python wrapper) in Quantopian you may want to use it in a Python environment such as iPython. There are sometimes issues installing ta-lib on Windows - I had to recompile in MS Visual Studio to get it working on Windows 7 64-bit - but there are now pre-compiled binaries here:

http://www.lfd.uci.edu/~gohlke/pythonlibs/

If you've ever encountered

Unable to find vcvarsall.bat  

you need this excellent site created by Christoph Gohlke.

Also see here https://github.com/mrjbq7/ta-lib for more information on ta-lib (the Python wrapper) created by John Benediktsson (mrjbq7).

P.

12 responses

Agree. I've used exceed 24 hours in web search, but all methods failed, you saved me. Thanks here ,it is why i registered.

Do you have to place the binary in the Python folder somewhere? and then just run " pip install" with the location of the file? Doesn't seem to work for me unfortunately. Where are you supposed to place the binary?

you get a python wheel (installer package) down from his site, you just pip install and that should be you.

Unfortunately it wasn't that simple: I had to install it in the directory holding pip.exe and pip install from there. The it worked.


C:\Anaconda\Scripts {git}  
{lamb} pip install TA_Lib-0.4.9-cp35-none-win_amd64.whl
Processing c:\anaconda\scripts\ta_lib-0.4.9-cp35-none-win_amd64.whl  
Installing collected packages: TA-Lib  
Successfully installed TA-Lib-0.4.9

C:\Anaconda\Scripts {git}  
{lamb}

Having loaded it in the root environment I still face the amusing challenge of loading TA-Lib to the various other environments.

OK, it may be your conda virtual envrionment didn't have pip isntalled in it.

when you do

conda list  

does pip show up? And now does the TA-Lib also show up there?

Anyway, you have it installed now which is good!

Unbelievably, the same trick did not work when I tried to install TA-Lib in one of my virtual environments since pip used different tags than in my root environment.

While in the relevant environment run import pip; print(pip.pep425tags.get_supported()) to see which tags pip uses.

In my root environment pip uses, inter alia, "CP35". In the relevant virtual environment the slightly later version of pip uses "CP27"

I therefore had to load a different wheel into the scripts directory of the virtual environment and the load was successful. If I merely try to run pip using a file location elsewhere on my computer pip cant find the wheel file. So I had to place a copy of the CP 27 wheel file directly in my environment script folder and run pip install from that location (IE cd the command prompt to that location). Hope this helps someone. No idea why pip can't find the wheel at any other location but life is too short to worry about it. Hope this helps someone else if they have a similar problem.
``` [Quants] C:\Anaconda\envs\Quants\Scripts {git} {lamb} python Python 2.7.11 |Continuum Analytics, Inc.| (default, Jan 19 2016, 12:08:31) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org

import pip; print(pip.pep425tags.get_supported())
[('cp27', 'cp27m', 'win_amd64'), ('cp27', 'none', 'win_amd64'), ('py2', 'none', 'win_amd64'), ('cp27', 'none', 'any'), ('cp2', 'none', 'any'), ('cp26', 'none', 'any'), ('cp25', 'none', 'any'), ('cp24', 'none', 'any'), ('cp23', 'none', 'any'), ('cp22', 'none', 'any'), ('cp21', 'none', 'any'), ('cp20', 'none', 'any'), ('py27', 'none',
'any'), ('py2', 'none', 'any'), ('py26', 'none', 'any'), ('py25', 'none', 'any'), ('py24', 'none', 'any'), ('py23', 'none', 'any'), ('py22', 'none', 'any'), ('py21', 'none', 'any'), ('py20', 'none', 'any')]
exit
Use exit() or Ctrl-Z plus Return to exit
exit()

[Quants] C:\Anaconda\envs\Quants\Scripts {git} {lamb} pip install C:\Anaconda\envs\Quants\Scripts/TA_Lib-0.4.9-cp27-none-win_amd64.whl Processing c:\anaconda\envs\quants\scripts\ta_lib-0.4.9-cp27-none-win_amd64.whl
Installing collected packages: TA-Lib
Successfully installed TA-Lib-0.4.9
You are using pip version 8.0.1, however version 8.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
```

In other words my mistake was I am using Python 3.5 in the root and 2.7 in the environment. I therefore needed different binaries for each.

If it of any help to anyone, I have solved the dreaded "can't find vcvarsall.bat" as regards python 3.5. Not sure which python version the latest zipline uses but.....

In any event, look here: wikipython

Install Microsoft Visual C++ Build Tools 2015. Check Windows 8.1 SDK and Windows 10 SDK options.
Replace the text in C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ vcvarsall.bat with the following:

rem Vcvarsall for Visual C++ Build Tools 2015  
@echo off  
set vcprogramfiles=%ProgramFiles(x86)%  
if "%vcprogramfiles%"=="" set vcprogramfiles=%ProgramFiles%  
call "%vcprogramfiles%\Microsoft Visual C++ Build Tools\vcbuildtools.bat" %*  

I am using 64 bit Anaconda and python 3.5 in a separate conda produced environment. In that environment where a pip install needs a c compiler, pip is now automatically able to find vcvarsall.bat

Hope this may be of help to someone!

Oh, by the way, I am using Windows 10 and even though logged in as administrator I was not permitted to save the amended file...or even save a differently named file in the same directory. I had to alter the permissions on the file to allow me to delete it. I then had to save the newly created file in my users/documents section...and move it to the relevant directory.

Unbelievable. But it worked. So, hopefully no more compiler problems...at least for python 3.5