TA-Lib / ta-lib-python

Python wrapper for TA-Lib (http://ta-lib.org/).
http://ta-lib.github.io/ta-lib-python
Other
9.79k stars 1.78k forks source link

Can't install on Windows #589

Closed Rodelanuit1 closed 1 year ago

Rodelanuit1 commented 1 year ago

I'm new to programming and i want help to install ta-lib in python and then on use it on pycharm. I've try for hours and still don't know how this work.

The readme give us solutions but the command $ python3 -m pip install TA-Lib
doesn't work. After created a pipy account i still don't know how to do and why it have a $ ??

Error is '$' n’est pas reconnu en tant que commande interne ou externe, un programme exécutable ou un fichier de commandes

Same for the second solution $ python setup.py install

And then i don't understand what does mean for the third solution to install? Especially the part Build the Library nmake ? I've follow the other parts of the solution

  1. 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

I've success to install in Anaconda but i want to import in Pycharm and I want the pip install ta-lib works

Also i've tried the TA_Lib‑0.4.24‑cp310‑cp310‑win_amd64.whl solution with no succes.

I have Python 3.11 and a PC 64 bits. Please help to understand.

mrjbq7 commented 1 year ago

A few comments and a few questions:

The $ command argument syntax is a bit more of a unix convention, but the $ means "run this command arguments in your shell...

When you say you've installed successfully in Anaconda, do you mean you have the ta-lib python module installed and available via conda? Or do you mean you installed the libta_lib package?

If you installed the library via conda, if you know where that command puts the libta_lib files then I can help you install this python wrapper.

Rodelanuit1 commented 1 year ago

Yes thank you , it's not a surprise for the $

I mean, in a Anaconda prompt i write pip install ta-lib I have now the response Requirement already satisfied: ta-lib in c:\prog\lib\site-packages (0.4.19) Requirement already satisfied: numpy in c:\prog\lib\site-packages (from ta-lib) (1.23.5)

Yes i have use the conda forge command to install

mrjbq7 commented 1 year ago

It sounds like you have it properly installed via conda, so the next steps would be to test it which you could do simply on the command line:

python -c "import talib; print(talib.__version__)"

And then setup your PyCharm to use the conda environment:

https://www.jetbrains.com/help/pycharm/conda-support-creating-conda-virtual-environment.html

Rodelanuit1 commented 1 year ago

python -c "import talib; print(talib.version)"

in Anaconda prompt 0.4.19

Ok i have trouble to manage to create the conda environnement. My conda executable is in a strange folder C:/Prog in the link, it's on a proper folder well named.

2 Browse for the directory which contains your source files and the environment.yml file, and then click Open (on Mac) or OK (on Windows): I don't understand what does that mean ? I believe my conda python script won't work wihout this environment.yml

Rodelanuit1 commented 1 year ago

I have forget previously the command conda install -c conda-forge libta-lib and it's say to me All requested packages already installed.

I still have the following error in cmd prompt

Building wheel for TA-lib (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for TA-lib (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [347 lines of output] This is my main purpose i want to pass on this error.

mrjbq7 commented 1 year ago

Do you have any of the [347 lines of output] that I could see?

mrjbq7 commented 1 year ago

It's probably not finding the path to the TA-Lib C library, which is typically C:\ta-lib but might be in a different spot with conda and you need to set TA_LIBRARY_PATH and TA_INCLUDE_PATH to point to it.

Rodelanuit1 commented 1 year ago

Do you have any of the [347 lines of output] that I could see?

Yes i have dear mrjbq7

Building wheel for ta-lib (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for ta-lib (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [347 lines of output] running bdist_wheel running build running build_py creating build creating build\lib.win32-cpython-311 creating build\lib.win32-cpython-311\talib copying talib\abstract.py -> build\lib.win32-cpython-311\talib copying talib\deprecated.py -> build\lib.win32-cpython-311\talib copying talib\stream.py -> build\lib.win32-cpython-311\talib copying talib\test_abstract.py -> build\lib.win32-cpython-311\talib copying talib\test_data.py -> build\lib.win32-cpython-311\talib copying talib\test_func.py -> build\lib.win32-cpython-311\talib copying talib\test_pandas.py -> build\lib.win32-cpython-311\talib copying talib\test_polars.py -> build\lib.win32-cpython-311\talib copying talib\test_stream.py -> build\lib.win32-cpython-311\talib copying talib__init__.py -> build\lib.win32-cpython-311\talib running build_ext building 'talib._ta_lib' extension creating build\temp.win32-cpython-311 creating build\temp.win32-cpython-311\Release creating build\temp.win32-cpython-311\Release\talib "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\bin\HostX86\x86\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Ic:\ta-lib\c\include "-IC:\Users\Network Info\AppData\Local\Temp\pip-build-env-ci7cyn4s\normal\Lib\site-packages\numpy\core\include" "-IC:\Users\Network Info\AppData\Local\Programs\Python\Python311\include" "-IC:\Users\Network Info\AppData\Local\Programs\Python\Python311\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tctalib/_ta_lib.c /Fobuild\temp.win32-cpython-311\Release\talib/_ta_lib.obj _ta_lib.c C:\Users\Network Info\AppData\Local\Temp\pip-build-env-ci7cyn4s\normal\Lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION talib/_ta_lib.c(7062): warning C4146: op‚rateur moins unaire appliqu‚ … un type non sign‚, le r‚sultat sera non sign‚ talib/_ta_lib.c(7067): warning C4146: op‚rateur moins unaire appliqu‚ … un type non sign‚, le r‚sultat sera non sign‚ talib/_ta_lib.c(7257): warning C4146: op‚rateur moins unaire appliqu‚ … un type non sign‚, le r‚sultat sera non sign‚ [................... much more like this] talib/_ta_lib.c(65369): warning C4146: op‚rateur moins unaire appliqu‚ … un type non sign‚, le r‚sultat sera non sign‚

 C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\bin\HostX86\x86\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c:\ta-lib\c\lib "/LIBPATH:C:\Users\Network Info\AppData\Local\Programs\Python\Python311\libs" "/LIBPATH:C:\Users\Network Info\AppData\Local\Programs\Python\Python311" "/LIBPATH:C:\Users\Network Info\AppData\Local\Programs\Python\Python311\PCbuild\win32" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\lib\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\ucrt\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22000.0\\um\x86" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\lib\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\ucrt\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22000.0\\um\x86" ta_libc_cdr.lib /EXPORT:PyInit__ta_lib build\temp.win32-cpython-311\Release\talib/_ta_lib.obj /OUT:build\lib.win32-cpython-311\talib\_ta_lib.cp311-win_amd64.pyd /IMPLIB:build\temp.win32-cpython-311\Release\talib\_ta_lib.cp311-win_amd64.lib
     Cr‚ation de la bibliothŠque build\temp.win32-cpython-311\Release\talib\_ta_lib.cp311-win_amd64.lib et de l'objet build\temp.win32-cpython-311\Release\talib\_ta_lib.cp311-win_amd64.exp
  _ta_lib.obj : error LNK2001: symbole externe non r‚solu __imp__PyNumber_InPlacePower
  _ta_lib.obj : error LNK2001: symbole externe non r‚solu __imp__PySequence_List
  _ta_lib.obj : error LNK2001: symbole externe non r‚solu __imp__PyBaseObject_Type
  _ta_lib.obj : error LNK2001: symbole externe non r‚solu __imp___PyDict_NewPresized
  _ta_lib.obj : error LNK2001: symbole externe non r‚solu __imp__PyObject_SetAttr
  _ta_lib.obj : error LNK2001: symbole externe non r‚solu __imp__PyUnicode_InternFromString
  _ta_lib.obj : error LNK2001: symbole externe non r‚solu __imp__PyCFunction_Type
  _ta_lib.obj : error LNK2001: symbole externe non r‚solu __imp__PyOS_snprintf
  _ta_lib.obj : error LNK2001: symbole externe non r‚solu __imp__PyThreadState_Get
  _ta_lib.obj : error LNK2001: symbole externe non r‚solu __imp__PyExc_Exception
  _ta_lib.obj : error LNK2001: symbole externe non r‚solu __imp__PyErr_SetObject
  _ta_lib.obj : error LNK2001: symbole externe non r‚solu __imp__PyCode_NewEmpty
  _ta_lib.obj : error LNK2001: symbole externe non r‚solu __imp__PyErr_GivenExceptionMatches
  _ta_lib.obj : error LNK2001: symbole externe non r‚solu __imp__PyList_Insert
  _ta_lib.obj : error LNK2001: symbole externe non r‚solu __imp__PyLong_AsUnsignedLong
  _ta_lib.obj : error LNK2001: symbole externe non r‚solu __imp__PyErr_WarnEx

[......much more like this] _ta_lib.obj : error LNK2001: symbole externe non r‚solu impPySequence_Tuple _ta_lib.obj : error LNK2001: symbole externe non r‚solu impPyUnicode_FromStringAndSize _ta_lib.obj : error LNK2001: symbole externe non r‚solu __imp___PyObject_GetDictPtr build\lib.win32-cpython-311\talib_ta_lib.cp311-win_amd64.pyd : fatal error LNK1120: 167 externes non r‚solus error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\bin\HostX86\x86\link.exe' failed with exit code 1120 [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for ta-lib Failed to build ta-lib ERROR: Could not build wheels for ta-lib, which is required to install pyproject.toml-based projects

It's probably not finding the path to the TA-Lib C library, which is typically C:\ta-lib but might be in a different spot with conda and you need to set TA_LIBRARY_PATH and TA_INCLUDE_PATH to point to it.

Ok i imagine . You mean like this

image

If you meaned that i stille can't pip install.

Just want to say , thank you to help me.

Rodelanuit1 commented 1 year ago

C:\ta-lib\c\make\cdr\win32\msvc>nmake

Microsoft (R) Program Maintenance Utility Version 14.35.32216.1 Copyright (C) Microsoft Corporation. Tous droits réservés.

NMAKE : fatal error U1064: MAKEFILE introuvable et aucune cible spécifiée Stop. image

Maybe someone knows what is wrong with this ? This is in the readme section for installing

Rodelanuit1 commented 1 year ago

Oh yes i finally got it

image

It's help me don't not use the developper command prompt instead USE Native tools Command Prompt And then the nmake is OK , and the pip install ta-lib too .

https://gist.github.com/mdalvi/e08115381992e42b43cad861dfe417d2?permalink_comment_id=3639795#gistcomment-3639795

mrjbq7 commented 1 year ago

I'm sorry that was so much trouble -- I will prioritize getting the cibuildwheel PR merged so we can generate binaries, it seems Windows is often problematic.