-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
I've been looking at installing ta-lib on Windows 8 64-bit but I am not confident. Here are my actions after deleting any previous python versions:
- Install VS2010 Ultimate
- Download ta-lib-0.4.0-msvc.zip and extract to c:\ta-lib
- Open C:\ta-lib\c\ide\vs2005\lib_proj\ta_lib.sln and compile 6 builds to 64-bit without errors
- Because I wanted my binaries to be used I deleted everything apart from:
(As downloaded)
C:\ta-lib\c\include\ta_abstract
C:\ta-lib\c\include\ta_common
C:\ta-lib\c\include\ta_defs
C:\ta-lib\c\include\ta_func
C:\ta-lib\c\include\libc
(Produced by VS2010)
C:\ta-lib\c\bin\ta_regtest
C:\ta-lib\c\bin\ta_regtest_cdr
C:\ta-lib\c\bin\gen_code
C:\ta-lib\c\bin\gen_code_cdr
C:\ta-lib\c\lib\ta_func_cdr
C:\ta-lib\c\lib\ta_libc_cdr
C:\ta-lib\c\lib\ta_abstract_cdr
C:\ta-lib\c\lib\ta_common_cdr - Following advice from here I amended setup.py to:
if sys.platform in ("linux2", "darwin"):
include_talib_dir = "/usr/local/include/"
lib_talib_dir = "/usr/local/lib/"
elif sys.platform == "win32":
include_talib_dir = r"c:\ta-lib\c\include"
lib_talib_dir = r"c:\ta-lib\c\lib" - Also from advice here I amended talib.c to:
#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#define isnan(x) _isnan(x) /* Added PC 2012-11-20 _/ << added - is this needed in VS2010?
#endif
#include <math.h>
#define __PYX_HAVE__talib
#define __PYX_HAVE_API__talib
#include "stdio.h"
#include "stdlib.h"
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#include "math.h"
#include "ta_libc.h" << amended
#ifdef OPENMP
#include <omp.h>
#endif / _OPENMP */ - I then installed python 2.7 64-bit and sys.maxsize confirms as 2^63-1
- I installed 64-bit binaries of numpy and Cython from http://www.lfd.uci.edu/~gohlke/pythonlibs/
- I found I had to use SET VS90COMNTOOLS=%VS100COMNTOOLS%
Now the problem. When I run 'python setup.py install' I get hundreds of warnings and errors like:
talib.c(2392) : warning C4133: '=' : incompatible types - from 'PyArrayObject *' to 'PyObject *'
.
.
talib.obj : error LNK2019: unresolved external symbol TA_GetVersionString referenced in function inittalib
build\lib.win-amd64-2.7\talib.pyd : fatal error LNK1120: 319 unresolved externals
The second time I run it I get 'skipping talib.c Cython extension (up-to-date)'. So my binaries are rubbish, right? But talib.pyd has been created.
In python I can 'import talib' and do the simple test:
data = numpy.random.random(100)
output = talib.SMA(data)
So have I got a 64-bit install? Or have I somehow got a 32-bit version by accident?
I suspect I am fooling myself. As a more complete test I installed PyAlgoTrade (see http://gbeced.github.com/pyalgotrade) which uses ta-lib and successfully ran the 204 tests in the test suite.
Regards,
Peter