Can't install ta-lib

when I use ‘pip install TA-lib’ raise an error, I’m using an env of python311 and pip works fine with other libs.

This is the output:

Using cached TA-Lib-0.4.30.tar.gz (368 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy in c:\users\lyx\desktop\reci\env\lib\site-packages (from ta-lib) (1.26.4)
Building wheels for collected packages: ta-lib
  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
  ╰─> [20 lines of output]
      <string>:75: UserWarning: Cannot find ta-lib library, installation may fail.
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\
      creating build\\talib
      copying talib\ -> build\\talib
      copying talib\ -> build\\talib
      copying talib\ -> build\\talib
      copying talib\ -> build\\talib
      running build_ext
      building 'talib._ta_lib' extension
      creating build\
      creating build\\Release
      creating build\\Release\talib
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Ic:\ta-lib\c\include -IC:\Users\Lyx\AppData\Local\Temp\pip-build-env-6e6rp6kp\normal\Lib\site-packages\numpy\core\include -IC:\Users\Lyx\Desktop\reci\env\include -IC:\Users\Lyx\AppData\Local\Programs\Python\Python311\include -IC:\Users\Lyx\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.18362.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.18362.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.18362.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.18362.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tctalib/_ta_lib.c /Fobuild\\Release\talib/_ta_lib.obj
      talib/_ta_lib.c(1223): fatal error C1083: No se puede abrir el archivo incluir: 'ta_libc.h': No such file or directory
      error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.39.33519\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [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

I don’t think pip installation is supported for Windows. Read the documentation:


Download and unzip to C:\ta-lib.

This is a 32-bit binary release. If you want to use 64-bit Python, you will need to build a 64-bit version of the library. Some unofficial instructions for building on 64-bit Windows 10 or Windows 11, here for reference:

You might also try these unofficial windows binary wheels for both 32-bit and 64-bit:

The maintainers have only pushed an sdist to PyPi, so pip, having not read the docs anymore than you have, valiantly attempts to build it from source.

Well, I think that pip works with Windows just fine. There could be some issues with MacOS.

Yes of course it does. But pip doesn’t even try to install a Linux-only-bdist on Windows, only build an sdist (platform support for binary libraries requires work from the library authors).

OP’s ‘problem’ is not due to pip. It is due to not reading the installation instructions.