ta-lib-python icon indicating copy to clipboard operation
ta-lib-python copied to clipboard

installation: "ta-lib/ta_defs.h: No such file or directory..."

Open SerzhYu opened this issue 13 years ago • 23 comments

I've installed lib from list: ta-lib-0.4.0-src.tar.gz, but I get na error as well like this: "...ta-lib/ta_defs.h: No such file or directory...":

root@serzh-desktop:/usr/local/include/ta-lib-master# python setup.py install

setup.py:49: UserWarning: Cannot find ta-lib library, installation may fail. warnings.warn('Cannot find ta-lib library, installation may fail.') running install running build running build_py running build_ext skipping 'talib/common.c' Cython extension (up-to-date) building 'talib.common' extension x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/usr/include/python2.7 -c talib/common.c -o build/temp.linux-x86_64-2.7/talib/common.o talib/common.c:314:28: фатальная ошибка: ta-lib/ta_defs.h: No such file or directory. компиляция прервана. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I have got OS Ubuntu 13.04 x64.

Thanks forward.

SerzhYu avatar Oct 22 '13 15:10 SerzhYu

The setup.py looks in these locations for that ta-lib header:

/usr/include/ta-lib/ta_defs.h
/usr/local/include/ta-lib/ta_defs.h
/opt/include/ta-lib/ta_defs.h
/opt/local/include/ta-lib/ta_defs.h

And you'll notice the warning at the first line that it can't find ta-lib, that means it can't find the library at any of these locations:

/usr/lib/libta_lib.so
/usr/local/lib/libta_lib.so
/opt/lib/libta_lib.so
/opt/local/lib/libta_lib.so

Do you know where you installed the underlying ta-lib library?

mrjbq7 avatar Oct 22 '13 16:10 mrjbq7

Thanks. I found mistake. I replaced 'usr' in ./configure --prefix=/usr on my account name, arter this ta-lib copied into wrong directory. I saw it after your answer, when check the fires two directory. Thanks for help!) It's really useful library!

SerzhYu avatar Oct 22 '13 17:10 SerzhYu

I solved the problem by making a folder named ta-lib in c:\ta-lib\c\include and copying all the files from the that folder to the new folder.

XenonTRX avatar Mar 18 '15 13:03 XenonTRX

@XenonTRX We use an ifdef on Windows to look for the header file, so I'm not sure why it wouldn't have worked normally for you:

https://github.com/mrjbq7/ta-lib/blob/master/talib/abstract.c#L342 https://github.com/mrjbq7/ta-lib/blob/master/talib/common.c#L311 (and similarly in func.c)

Which version are you using, current master?

mrjbq7 avatar Mar 18 '15 15:03 mrjbq7

Hi guys,

I'm very keen on getting this work but coming across a few roadblocks.

I feel that I am very close (but yet so far away) from getting it to work. So after overcoming several obstacles (not a linux expert) I am at the point where the installation is failing because it cannot find the underlying ta-lib in C.

You mentioned: /usr/lib/libta_lib.so /usr/local/lib/libta_lib.so /opt/lib/libta_lib.so /opt/local/lib/libta_lib.so

SO.. unfortunately for me, because I am on a shared hosting plan, I do not have write permissions on ANY of the aforementioned folders. I installed it on my ~/talib.

Is it possible at all to have tell the pip install Ta-lib to look into a specific folder (in my case ~/ta-lib) or somehow trick the system into looking in there via a symlink or anything like that?

Thanks so much in advance!

elDudarino avatar Jan 19 '18 23:01 elDudarino

Yes, we do.

Did you install it to a particularly local and writable directory using ./configure --prefix=$DIR? (And then make and make install).

That command would make $DIR/bin, $DIR/include/ta-lib, $DIR/lib with the various binaries and files that the underlying TA-Lib C library installs with.

Then you should be able to just:

$ TA_INCLUDE_PATH=$DIR/include TA_LIBRARY_PATH=$DIR/lib python setup.py install

mrjbq7 avatar Jan 19 '18 23:01 mrjbq7

Hi John,

First of all, thank you very much for the prompt response. Very much appreciated!!

Yes, I originally used ./configure --prefix=/home/brandadmin/talib then: make: then: make install

I had originally downloaded the .tar.gz but reading the other posts here I realized I'd need the master source code to use the setup.py install you've referenced so I downloaded that and ran line you suggested:

TA_INCLUDE_PATH=/home/brandadmin/talib/include/ TA_LIBRARY_PATH=/home/brandadmin/talib/lib/ python setup.py install

Here's the output... running install running build running build_py running build_ext skipping 'talib/_ta_lib.c' Cython extension (up-to-date) building 'talib._ta_lib' extension gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/brandadmin/anaconda3/envs/webtrader/lib/python3.6/site-packages/numpy/core/include -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/home/brandadmin/talib/include/ -I/home/brandadmin/anaconda3/envs/webtrader/include/python3.6m -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.6/talib/_ta_lib.o

... and then I get a bunch of these types of errors:

talib/_ta_lib.c:203539: warning: assignment from incompatible pointer type talib/_ta_lib.c:203644: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_634stream_STOCHF': talib/_ta_lib.c:204068: warning: assignment from incompatible pointer type talib/_ta_lib.c:204173: warning: assignment from incompatible pointer type talib/_ta_lib.c:204278: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_636stream_STOCHRSI': talib/_ta_lib.c:204690: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_638stream_SUB': talib/_ta_lib.c:204981: warning: assignment from incompatible pointer type talib/_ta_lib.c:205086: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_640stream_SUM': talib/_ta_lib.c:205393: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_642stream_T3': talib/_ta_lib.c:205683: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_644stream_TAN': talib/_ta_lib.c:205902: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_646stream_TANH': talib/_ta_lib.c:206121: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_648stream_TEMA': talib/_ta_lib.c:206395: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_650stream_TRANGE': talib/_ta_lib.c:206679: warning: assignment from incompatible pointer type talib/_ta_lib.c:206784: warning: assignment from incompatible pointer type talib/_ta_lib.c:206889: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_652stream_TRIMA': talib/_ta_lib.c:207229: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_654stream_TRIX': talib/_ta_lib.c:207503: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_656stream_TSF': talib/_ta_lib.c:207777: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_658stream_TYPPRICE': talib/_ta_lib.c:208061: warning: assignment from incompatible pointer type talib/_ta_lib.c:208166: warning: assignment from incompatible pointer type talib/_ta_lib.c:208271: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_660stream_ULTOSC': talib/_ta_lib.c:208671: warning: assignment from incompatible pointer type talib/_ta_lib.c:208776: warning: assignment from incompatible pointer type talib/_ta_lib.c:208881: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_662stream_VAR': talib/_ta_lib.c:209237: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_664stream_WCLPRICE': talib/_ta_lib.c:209521: warning: assignment from incompatible pointer type talib/_ta_lib.c:209626: warning: assignment from incompatible pointer type talib/_ta_lib.c:209731: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_666stream_WILLR': talib/_ta_lib.c:210099: warning: assignment from incompatible pointer type talib/_ta_lib.c:210204: warning: assignment from incompatible pointer type talib/_ta_lib.c:210309: warning: assignment from incompatible pointer type talib/_ta_lib.c: In function '__pyx_pf_5talib_7_ta_lib_668stream_WMA': talib/_ta_lib.c:210649: warning: assignment from incompatible pointer type

.... and lastly is finishes with: gcc: Internal error: Killed (program cc1) Please submit a full bug report. See http://bugzilla.redhat.com/bugzilla for instructions. error: command 'gcc' failed with exit status 1

I am wondering if there is hope for me... do you have any further ideas on what I could try?

Thanks a million!

elDudarino avatar Jan 19 '18 23:01 elDudarino

That gcc error happened on another thread:

https://github.com/mrjbq7/ta-lib/issues/133#issuecomment-308944218

And the "fix" turned out to be more memory.

mrjbq7 avatar Jan 19 '18 23:01 mrjbq7

for mac: brew install ta-lib

pip install ta-lib

kuabhish avatar Jun 10 '19 18:06 kuabhish

for mac: brew install ta-lib

pip install ta-lib

This worked for me on mac, thank you

ahaque5369 avatar Apr 10 '20 18:04 ahaque5369

I'm running a WSL2 session (Fedora remix) on a Windows 10 machine and getting the following error:

talib/_ta_lib.c:611:10: fatal error: ta-lib/ta_defs.h: No such file or directory 611 | #include "ta-lib/ta_defs.h" | ^~~~~~~~~~~~~~~~~~ compilation terminated. error: command 'gcc' failed with exit status 1

after issuing the command: pip install TA-Lib --user

How do I fix this please?

imamushroom avatar Dec 15 '20 09:12 imamushroom

for mac: brew install ta-lib

pip install ta-lib

Thanks. This works for me too.

hanung665 avatar Jun 28 '21 13:06 hanung665

can execute these commands curl -L -O http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && tar -xvzf ta-lib-0.4.0-src.tar.gz && cd ta-lib/ && ./configure --prefix=/usr && make && make install export TA_INCLUDE_PATH="/usr/include" export TA_INCLUDE_PATH="/usr/lib" this is fix installation of ta-lib

yassine-elazrak avatar Mar 11 '22 10:03 yassine-elazrak

for mac: brew install ta-lib

pip install ta-lib

`brew install ta-lib Running brew update --auto-update . . . fatal: Could not resolve HEAD to a revision ==> Auto-updated Homebrew! Updated 1 tap (homebrew/cask). ==> New Casks cardinal

Warning: No available formula with the name "ta-lib". ==> Searching for similarly named formulae... Error: No similarly named formulae found. ==> Searching for a previously deleted formula (in the last month)... Error: No previously deleted formula found. ==> Searching taps on GitHub... Error: No formulae found in taps.` When i use the command brew install ta-lib, this pops up What should I do?

elLau0 avatar Jul 15 '22 11:07 elLau0

Sounds like a homebrew issue, perhaps try “brew doctor” and see if there are any obvious errors to resolve. The fatal note about HEAD revision may be related to your issue.

On Jul 15, 2022, at 2:17 PM, elLau0 @.***> wrote:

 for mac: brew install ta-lib

pip install ta-lib

brew install ta-lib Running brew update --auto-update`... fatal: Could not resolve HEAD to a revision ==> Auto-updated Homebrew! Updated 1 tap (homebrew/cask). ==> New Casks cardinal ukrainian-typographic-keyboard

Warning: No available formula with the name "ta-lib". ==> Searching for similarly named formulae... Error: No similarly named formulae found. ==> Searching for a previously deleted formula (in the last month)... Error: No previously deleted formula found. ==> Searching taps on GitHub... Error: No formulae found in taps.` When i use the command brew install ta-lib, this pops up What should I do?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.

mrjbq7 avatar Jul 15 '22 13:07 mrjbq7

Sounds like a homebrew issue, perhaps try “brew doctor” and see if there are any obvious errors to resolve. The fatal note about HEAD revision may be related to your issue. …

After checking homebrew with brew doctor and uninstalling it and installing it again, same error appears

elLau0 avatar Jul 18 '22 13:07 elLau0

This still fails in fresh install of Ubuntu 22.04, amazing python ecosystem, a more helpful error message is surely welcome. As this issue is # 1 on google, here's the solution: https://cloudstrata.io/install-ta-lib-on-ubuntu-server/

wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib/
sudo ./configure
sudo make
sudo make install
pip install ta-lib

movy avatar Sep 11 '22 17:09 movy

That error means you don’t have the Ta-Lib C library available to compile against. Did you install it? What path is it installed to?

On Sep 11, 2022, at 10:13 AM, movy @.***> wrote:

 This still fails in fresh install of Ubuntu 22.04, amazing python ecosystem.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.

mrjbq7 avatar Sep 11 '22 17:09 mrjbq7

amazing indeed - 9 years and this error still creeps in. thx - ur solution solved it for me. only problem is latest version is 0.4.25...and prodownloads doesnt have that latest version. anyone know where we can get the latest tar?

dss010101 avatar Oct 09 '22 12:10 dss010101

pip install TA-Lib failed with What worked for me was slightly different than what @movy had -- followed instructions from https://pypi.org/project/TA-Lib/

Download ta-lib-0.4.0-src.tar.gz and:

 tar -xzf ta-lib-0.4.0-src.tar.gz
 cd ta-lib/
 ./configure --prefix=/usr
 make
 sudo make install

sunapi386 avatar Jan 19 '23 00:01 sunapi386