ta-lib-python icon indicating copy to clipboard operation
ta-lib-python copied to clipboard

Installation On Windows 8 64-Bit?

Open pcawthron opened this issue 14 years ago • 10 comments

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

pcawthron avatar Nov 20 '12 21:11 pcawthron

The link errors seem like they would be real errors, and I would have thought would prevent the C module from being used properly...

But if you can use talib.SMA and the pyalgotrade tests then it would seem to be working...?

mrjbq7 avatar Nov 20 '12 22:11 mrjbq7

I've just installed 64-bit IPython and I'm playing in there. I get:

In [12]: talib.version Out[12]: '0.4.0 (Nov 20 2012 17:51:48)'

which was when I ran 'python setup.py install'

In[13]: sys.maxsize Out[13]: 9223372036854775807L

Is there anything else I can check?

Regards,

Peter

pcawthron avatar Nov 20 '12 23:11 pcawthron

I made some changes to fix the problem using isnan, are there other changes I can make to help Windows installations be easier?

mrjbq7 avatar Feb 01 '13 20:02 mrjbq7

Hi, I'm trying to install talib in python 3 for windows 10 64bits, I really don't understand how to do ... how could I compile?

slot-29 avatar Aug 28 '19 02:08 slot-29

Follow the directions in the readme?

https://github.com/mrjbq7/ta-lib/blob/master/README.md#windows

On Aug 27, 2019, at 8:11 PM, slot-29 [email protected] wrote:

Hi, I'm trying to install talib in python 3 for windows 10 64bits, I really don't understand how to do ... how could I compile?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

mrjbq7 avatar Aug 28 '19 02:08 mrjbq7

¿Seguir las instrucciones en el archivo Léame? https://github.com/mrjbq7/ta-lib/blob/master/README.md#windows ... El 27 de agosto de 2019, a las 8:11 p.m., slot-29 @.***> escribió: Hola, estoy tratando de instalar talib en Python 3 para Windows 10 64 bits, realmente no ' No entiendo cómo hacerlo ... ¿cómo podría compilar? - Estás recibiendo esto porque comentaste. Responda a este correo electrónico directamente, visualícelo en GitHub o silencie el hilo.

yes, but so far it has been impossible to install ta-lib and I really need the library

slot-29 avatar Aug 28 '19 02:08 slot-29

¿Seguir las instrucciones en el archivo Léame? https://github.com/mrjbq7/ta-lib/blob/master/README.md#windows ... El 27 de agosto de 2019, a las 8:11 pm, slot-29 @ . ***> escribió : Hola, estoy tratando de instalar talib en Python 3 para Windows 10 64 bits, realmente no 'No entiendo cómo hacerlo ... ¿cómo podría compilar? - Estás recibiendo esto porque comentaste. Responda a este correo electrónico directamente, visualícelo en GitHub o silencie el hilo.

sí, pero hasta ahora ha sido imposible instalar ta-lib y realmente necesito la biblioteca

import talib as ta ModuleNotFoundError: No module named 'talib'

slot-29 avatar Aug 28 '19 02:08 slot-29

You have to install the underlying TA-Lib C library in 64-bit. After that you can install this wrapper.

On Aug 27, 2019, at 8:41 PM, slot-29 [email protected] wrote:

¿Seguir las instrucciones en el archivo Léame? https://github.com/mrjbq7/ta-lib/blob/master/README.md#windows ... El 27 de agosto de 2019, a las 8:11 pm, slot-29 @ . ***> escribió : Hola, estoy tratando de instalar talib en Python 3 para Windows 10 64 bits, realmente no 'No entiendo cómo hacerlo ... ¿cómo podría compilar? - Estás recibiendo esto porque comentaste. Responda a este correo electrónico directamente, visualícelo en GitHub o silencie el hilo.

sí, pero hasta ahora ha sido imposible instalar ta-lib y realmente necesito la biblioteca

import talib as ta ModuleNotFoundError: No module named 'talib'

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

mrjbq7 avatar Aug 28 '19 02:08 mrjbq7

I already did all this:

Download and Unzip ta-lib-0.4.0-msvc.zip Move the Unzipped Folder ta-lib to C:
Download and Install Visual Studio Community 2015 Remember to Select [Visual C++] Feature Build TA-Lib Library From Windows Start Menu, Start [VS2015 x64 Native Tools Command Prompt] Move to C:\ta-lib\c\make\cdr\win32\msvc Build the Library nmake

but in this case: "Build the Library nmake" the only thing I did was write on nmake console .. is something else missing?

slot-29 avatar Aug 28 '19 03:08 slot-29

There is a pre-compiled 64-bit version of the TA-Lib C library at https://github.com/afnhsn/TA-Lib_x64 which I installed today on Windows 10 with Python 2.7.16 and it works without issue. I simply deleted my old C:\talib and unzipped the 64-bit to a folder with the same name.

[I know I'm replying after several weeks but this may help others later.]

Regards,

Peter

pcawthron avatar Oct 13 '19 19:10 pcawthron