Is it possible that Mac M1 users are not able to use Python wrapper for TA-Lib?
Asked Answered
C

4

5

so I've been trying different methods to install TA-Lib, and found several different methods to install it, none of which have been easy, but even when TA-Lib is installed and appears on pip list, and even managed to install it on pipenv virtual environment, however if I actually want to go ahead and use it by typing

import talib

I get the following error:

ImportError: 2): Symbol not found: _TA_ACOS Referenced from: /Users/teo/.local/share/virtualenvs/trendingcoin-nriNAUCq/lib/python3.8/site-packages/talib/_ta_lib.cpython-38-darwin.so Expected in: flat namespace in /Users/teo/.local/share/virtualenvs/trendingcoin-nriNAUCq/lib/python3.8/site-packages/talib/_ta_lib.cpython-38-darwin.so

Now I would like you to know that I have tried many different methods to install it, they are detailed in this thread: Is it enough to install TA-Lib on Brew to use it? Pip throws me an error

As a wanna-be technical analyst, it would be sad if I can't use the infamous TA-Lib.

Coloquintida answered 5/2, 2021 at 2:23 Comment(4)
Python 3.9 is the first version of Python that supports Mac M1.Oblong
oh wow, good to knowColoquintida
Similar github issue (there may be others)Fatsoluble
Here is a solution to install talib on an Mac M1 CPU: github.com/mrjbq7/ta-lib/issues/408#issuecomment-855438491Yoshikoyoshio
H
3

I was able to make it work following some of the steps in this github issue: https://github.com/mrjbq7/ta-lib/issues/381

$ arch -x86_64 brew install [email protected]
$ arch -x86_64 brew install ta-lib
$ arch -x86_64 brew link ta-lib
$ arch -x86_64 python3.9 -m pip install --no-cache-dir ta-lib

You'll need x86/brew and rosetta: https://mcmap.net/q/82570/-error-cannot-install-in-homebrew-on-arm-processor-in-intel-default-prefix-usr-local

NOTE: In my case, I went though so many intents, that really made the difference to include the --no-cache-dir option.

Heterolecithal answered 11/4, 2021 at 13:37 Comment(0)
D
3

The solution here seems to work:

https://github.com/mrjbq7/ta-lib/issues/408#issuecomment-839583759

$ conda install -c conda-forge ta-lib

Dissenter answered 25/5, 2022 at 18:36 Comment(0)
M
2

Install ta-lib

brew install ta-lib

Find pip command for your environment

which -a pip 
/home/<user>/.conda/envs/newenv/bin/pip <---------------
/usr/bin/pip 

Install ta-lib wrapper via pip command

/home/<user>/.conda/envs/newenv/bin/pip install ta-lib
Microbicide answered 20/6, 2022 at 19:54 Comment(0)
N
0

Here's what I did with my Mac M1:

# install python3.10
arch -arm64 brew install ta-lib
export TA_INCLUDE_PATH="$(brew --prefix ta-lib)/include"
export TA_LIBRARY_PATH="$(brew --prefix ta-lib)/lib"
arch -arm64 python -m pip install --no-cache-dir ta-lib
Niersteiner answered 15/10, 2022 at 17:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.