Trouble Installing TA-Lib in Python 3.7
Here is what works for me...
Download TA_Lib-0.4.10-cp27-cp27m-win_amd64.whl from here
And use command pip install TA_Lib-0.4.10-cp27-cp27m-win_amd64.whl
I was using Conda4 with python 3.6 64 bit version.
Another way also you can try
To install Ta-Lib with Python 3.6+, Windows 64 bit use this pip install -i https://pypi.anaconda.org/masdeseiscaracteres/simple ta-lib
Python TA-Lib install problems
You could try the "Unofficial Windows Binaries for Python Extension Packages
by Christoph Gohlke, Laboratory for Fluorescence Dynamics, University of California, Irvine."
http://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib
He has different versions compiled depending on OS and Python versions. You probably need TA_Lib‑0.4.10‑cp35‑cp35m‑win_amd64.whl
Good luck.
When installing TA-Lib I get the following - ERROR: Command errored out with exit status 1:
TA-Lib is a C-library. You're trying to install a python wrapper for it and it can't find C library during installation. Wrapper prints:setup.py:71: UserWarning: Cannot find ta-lib library, installation may fail.
So, firstly, install the C library binary, then install python wrapper. Check out Dependencies section at https://mrjbq7.github.io/ta-lib/install.html
ta-lib replit python install problem, ERROR: No matching distribution found for talib-binary
Getting TA-Lib work on Replit
(by installing it from sources)
Create a new replit with Nix toolset with a Python template.
In main.py write:
import talib
print (talib.__ta_version__)
This will be our test case. If ta-lib is installed the python main.py
(executed in Shell) will return something like:
$ python main.py
b'0.6.0-dev (Jan 1 1980 00:00:00)'
We need to prepare a tools for building TA-Lib sources. There is a replit.nix
file in your project's root folder (in my case it was ~/BrownDutifulLinux
). Every time you execute a command like cmake
the Nix reports that:
cmake: command not installed. Multiple versions of this command were found in Nix.
Select one to run (or press Ctrl-C to cancel):
cmake.out
cmakeCurses.out
cmakeWithGui.out
cmakeMinimal.out
cmake_2_8.out
If you select cmake.out it will add a record about it into the replit.nix
file. And next time you call cmake, it will know which cmake version to launch. Perhaps you may manually edit replit.nix
file... But if you're going to add such commands in a my way, note that you must execute them in Shell in your project root folder as replit.nix
file is located in it. Otherwise Nix won't remember your choice.
After all my replit.nix
file (you may see its content with cat replit.nix
) content was:
{ pkgs }: {
deps = [
pkgs.libtool
pkgs.automake
pkgs.autoconf
pkgs.cmake
pkgs.python38Full
];
env = {
PYTHON_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
# Needed for pandas / numpy
pkgs.stdenv.cc.cc.lib
pkgs.zlib
# Needed for pygame
pkgs.glib
# Needed for matplotlib
pkgs.xorg.libX11
];
PYTHONBIN = "${pkgs.python38Full}/bin/python3.8";
LANG = "en_US.UTF-8";
};
}
Which means I executed libtool
, autoconf
, automake
and cmake
in Shell. I always choose a generic suggestion from Nix, without a specific version. Note: some commands may report errors as we executing them in a wrong way just to add to a replit.nix
.
3.
Once build tools are set up we need to get and build TA-Lib C library sources. To do that execute in Shell:
git clone https://github.com/TA-Lib/ta-lib.git
then
cd ta-lib/
libtoolize
autoreconf --install
./configure
If configure
script is completed without any problems, build the library with:
make -j4
It will end up with some compilation errors, but they are related to some additional tools which are used to add new TA-Lib indicators and build at the end, but not the library itself. The library will be successfully compiled and you should be able to see it with:
$ ls ./src/.libs/
libta_lib.a libta_lib.lai libta_lib.so.0
libta_lib.la libta_lib.so libta_lib.so.0.0.0
Now we have our C library built, but we can't install it to a system default folders. So we have to use the library as is from the folders where it was build. All we need is just one more additional preparation:
mkdir ./include/ta-lib
cp ./include/*.h ./include/ta-lib/
This will copy a library headers to a subfolder, as they are designed to be used from a such subfolder (which they don't have due to impossibility to perform the installation step).
4.
Now we have TA-Lib C library built and prepared to be used locally from its build folders. All we need after that - is to compile the Python wrapper for it. But Python wrapper will look for a library only in system default folders, so we need to instruct it where our library is.
To do this, execute pwd
and remember the absolute path to your project's root folder. In my case it was:/home/runner/FormalPleasedOffice
Then adjust the paths (there are two) in a following command to lead to your project path:TA_INCLUDE_PATH=/home/runner/FormalPleasedOffice/ta-lib/include/ TA_LIBRARY_PATH=/home/runner/FormalPleasedOffice/ta-lib/src/.libs/ pip install ta-lib
This is one line command, not a two commands.If the paths would be shorter it would look like:TA_INCLUDE_PATH=/path1/ TA_LIBRARY_PATH=/path2/ pip install ta-lib
.
After execution of this command the wrapper will be installed with two additional paths where it will look for a library and its header files.
That's actually all.
An alternative way would be to clone the wrapper sources, edit its setup.py and install wrapper manually. Just for the record this would be:
cd ~/Your_project
git clone https://github.com/mrjbq7/ta-lib.git ta-lib-wrapper
cd ta-lib-wrapper
Here edit the setup.py. Find the lines include_dirs = [
and library_dirs = [
and append your paths to these lists. Then you just need to:
python setup.py build
pip install .
Note the dot at the end.
5.
Go to the project's folder and try our python script:
$python main.py
b'0.6.0-dev (Jan 1 1980 00:00:00)'
Bingo!
Related Topics
How to Sort Pandas Dataframe from One Column
Loop Through All Nested Dictionary Values
Difference Between Venv, Pyvenv, Pyenv, Virtualenv, Virtualenvwrapper, Pipenv, etc
Python Gdal 2.1 Installation on Ubuntu 16.04
Give the Python Terminal a Persistent History
How to Parse the Output of /Proc/Net/Dev into Key:Value Pairs Per Interface Using Python
/Usr/Bin/Ld: Cannot Find -Lpython2.7
Python Linux Selenium: Chrome Not Reachable
Finding the Command for a Specific Pid in Linux from Python
Error While Installing Matplotlib
Importerror: Libtk8.6.So: Cannot Open Shared Object File: No Such File or Directory
How to Package a Python Daemon with Setuptools
How to Downgrade My Version of Python from 3.7.5 to 3.6.5 on Ubuntu
Understanding Python Fork and Memory Allocation Errors
Proxies With Python 'Requests' Module