'How to install TA-Lib On vscode/windows(64bit)
I have installed Anaconda and then cd to my project folder and then I installed TALIB using
pip install TA_Lib-0.4.19-cp38-cp38-win_amd64.whl
When I run pip freeze on anaconda , talib can be found and runs without problem.
However when I use it on vscode, it seems to be a problem , the interpreter I have tried is the virtual env and conda interpreter on vscode.
Both keeps showing no module named talib because the module shown here is TA-Lib
Please advise.
Solution 1:[1]
Please use the command "python --version
" in the anaconda terminal and the terminal in VSCode to check whether the Python you are currently using is consistent.
When we are in different Python environments in VSCode, the modules are stored in different locations. Therefore, we need to select the Python environment in which the module "talib
" is installed in VSCode (please choose the same Python used in anaconda).
Reference: Using Python environments in VS Code.
Solution 2:[2]
Thanks to @Jill Cheng
Basically the answer is tricky.
a. In the anaconda environment make sure you check the python version
python3 --version
b. Go to https://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib and download the suitable package . Since I am using python 3.9.1 and I am using 64 bits window. So I downloaded this file TA_Lib?0.4.19?cp39?cp39?win_amd64.whl
c. Then I ran python3 -m pip install {filename on b}
python3 -m pip install TA_Lib?0.4.19?cp39?cp39?win_amd64.whl
d. Check if talib is installed. Run
python3
e. Run the following command
import talib
f. If there is no problem , then you can put in on py file. For an example my py file is example.py
#example.py
import numpy
import talib
close = numpy.random.random(100)
upper, middle, lower = talib.BBANDS(close, matype=MA_Type.T3)
print(middle)
g. You should be able to see middle printed out once you run python3 example.py
.
Solution 3:[3]
Here the solution of TA-LIB for Anaconda, Visual Studio Code and PyCharm.
step 1:
Find the version of your pc in the settings (just check if its 64x or 32x).
Then open the terminal and check your python version by typing python --version
step 2: Then go to this link [https://www.lfd.uci.edu/~gohlke/pythonlibs/] and on the list search for 'ta-lib', search by Ctrl+f if windows and Command+f in mac will be easier.
step 3: once you clicked on the 'ta-lib' a new window with a list will be open, find the version of your python and pc under the TA-Lib section and you'll get a file in the download folder of your pc. well, copy that file in the directory of the project you are working on.
step 4:
Open the terminal (any terminal) make sure to be in the directory where you just pasted the file, then type pip install then enter.
Then type again pip install ta-lib
step 5: You can now work with ta-lib by just importing it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jill Cheng |
Solution 2 | desh |
Solution 3 | Eric Aya |