This is the 20th day of my participation in the August More Text Challenge

If ❤️ my article is helpful, welcome to like, follow. This is the biggest encouragement for me to continue my technical creation. More previous articles in my personal column

Windows 10 64-bit system Talib installation failure troubleshooting

background

Life is short. I use Python. Although Java is the beginning of big data, I switch to Python as soon as I start. Recently, I encountered a problem in the process of data analysis, so I recorded the process

During the execution of the program, the problem of missing talib module was encountered:

D:\Dev\env\measure\Scripts\python.exe D:/Dev/workplace/python/data-analyze/data/load_hive_data.py Traceback (most recent  call last): File "D:/Dev/workplace/python/data-analyze/data/load_hive_data.py", line 1, in <module> from intodatabase.util.load_data_util import LoadDataUtil File "D:/Dev/workplace/python/data-analyze/data/load_hive_data.py", line 7, in <module> import talib as ta ModuleNotFoundError: No module named 'talib'Copy the code

PIP loading is not common. PIP Install Talib tapped the command and sent it back to confirm execution. Then came the surprise

pip install -i https://pypi.douban.com/simple/ talib Looking in indexes: https://pypi.douban.com/simple/ Collecting talib Downloading https://pypi.doubanio.com/packages/1a/80/3492aa3065d7d81a6c51db78920108f84fbe19c4e2740f6bbb83d42f77a4/talib-0.1.1.tar.gz Using legacy 'setup.py install' for talib, since package 'wheel' is not installed. Installing collected packages: talib Running setup.py install for talib ... error ERROR: Command errored out with exit status 1: command: 'd:\dev\env\measure\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-xchq4_kk\\tali ... xchq4_kk\talib_3bf20ca4ad49420eb9bdfd123ca06d49\setup.py", line 20, in run raise Exception("You probably meant to install and run ta-lib") Exception: You probably meant to install and run ta-lib ---------------------------------------- ERROR: Command errored out with exit status 1: 'd:\dev\env\data-analyze\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; Single-version-managed --compile --install-headers D :\dev\env\measure\include\site\python3.7\talib' Check the logs for full command output.Copy the code

Meow, meow, meow, what PIP installation failed? What’s going on? So I looked it up and asked:

The reason for this is that the Python PIP source and ta-lib installation package are actually 32-bit and will not work properly if your system is 64-bit. The correct way to do this is to download the TA-lib 64-bit installation package. The 64-bit installation package is not available on the official website, so we must download it ourselves.

So we went to the Python library at the University of California to find ta-lib

  • TA-Lib: a wrapper for the TA-LIB Technical Analysis Library.

    • TA_Lib ‑ 0.4.21 ‑ cp39 ‑ cp39 ‑ win32. WHL
    • TA_Lib ‑ 0.4.21 ‑ cp38 ‑ cp38 ‑ win_amd64, WHL
    • TA_Lib ‑ 0.4.21 ‑ cp38 ‑ cp38 ‑ win32. WHL
    • TA_Lib ‑ 0.4.21 ‑ cp37 ‑ cp37m ‑ win_amd64, WHL
    • TA_Lib ‑ 0.4.21 ‑ cp37 ‑ cp37m ‑ win32. WHL
    • TA_Lib ‑ 0.4.17 ‑ cp27 ‑ cp27m ‑ win_amd64, WHL
    • TA_Lib ‑ 0.4.17 ‑ cp27 ‑ cp27m ‑ win32. WHL

Cp27 CP27M WIN32 represents python2.7-WIN 32-bit installation package, and so on. Since my system is 64-bit Python 3.7, I download TA_Lib‑0.4.21‑ CP37 ‑ CP37m ‑ Win_amd64.whl

$PIP install TA_Lib 0.4.21 CP37 CP37m WIN_AMd64. WHL Looking in indexes: https://pypi.tuna.tsinghua.edu. cn/simple Processing c: \ Windows \ system32 \ ta_lib - 0.4.21 ‑ cp37 ‑ cp37m ‑ win_amd64, WHL Installing COLLECTED Packages: TA-lib Successfu1ly INSTa1LED TA-Lib-0.4.21Copy the code

The ta-lib setup problem on 64-bit systems was solved perfectly