Open jcabourne opened 4 days ago
if you migrated from an intel mac, then your brew is probably /usr/local/
which is the intel location, in the apple silicon native world brew would be in /opt
, you can do which brew
and see.
you might also have python's installed that are intel.
it only works if your TA-Lib C library (brew install ta-lib) matches your python (brew install python) which matches your ta-lib python module (pip install ta-lib).
The other problem that happens sometimes is the pip
isn't the same as the python you want to run so i recommend making sure it is by doing python3.13 -m pip install ta-lib
or whatever version you want.
you do not want to do arch -arm64 brew install ta-lib
, using the "intel homebrew", that will mess things up. they would prefer you do /usr/local/bin/brew
for intel and /opt/homebrew/bin/brew
for arm64.
Thank you for the quick response.
You're correct it appears i am using /usr/local/bin/brew
What is the best way to switch to opt/?
Install it again using their directions:
You'll end up with "two brews", and can decide if you need intel libraries (keep /usr/local homebrew stuff) or not (delete /usr/local homebrew stuff).
So i deleted the old brew and reinstall the the new brew in opt/
Unfortunately the brew command stop working so i alias'd the brew command to the opt/ version of brew.
(base) ja*****@Mac ~ % which brew brew: aliased to /opt/homebrew/bin/brew
(base) ja*****@Mac ~ % arch -arm64 brew install ta-lib arch: Can't find brew in PATH
(base) ja*****@Mac ~ %
On my apple silicon mac:
➜ ~ which brew
/opt/homebrew/bin/brew
➜ ~ brew install ta-lib
Warning: ta-lib 0.4.0 is already installed and up-to-date.
To reinstall 0.4.0, run:
brew reinstall ta-lib
➜ ~ /opt/homebrew/bin/brew install ta-lib
Warning: ta-lib 0.4.0 is already installed and up-to-date.
To reinstall 0.4.0, run:
brew reinstall ta-lib
You don't need arch -arm64
because the arch of your machine is already arm64.
Going through all those commands i have the same output.
But i still get the error:
ImportError: dlopen(/Users/ja***/opt/anaconda3/lib/python3.12/site-packages/talib/_ta_lib.cpython-312-darwin.so, 0x0002): symbol not found in flat namespace '_TA_ACOS'
I have just seen that Notebook looks to still be pointing at usr version of brew.
Last login: Sun Nov 10 13:54:21 on ttys001 /Users/ja/.zprofile:2: no such file or directory: /usr/local/bin/brew /Users/ja/opt/anaconda3/bin/jupyter_mac.command ; exit; (base) ja**@Mac ~ % /Users/jamescabourne/opt/anaconda3/bin/jupyter_mac.command ; exit;
sorry im aware we are moving further away from a TALIB issue now but do you have any idea how to change this to the new brew version
I'm sorry it's frustrating, moving from intel to apple silicon was for me too until i had all this stuff split out.
I would guess your python is still intel, but here's generally how I think about it:
do i have arm64 brew
➜ ~ which brew
/opt/homebrew/bin/brew
do i have arm64 ta-lib
➜ ~ file $(brew --prefix ta-lib)/lib/libta_lib.dylib
/opt/homebrew/opt/ta-lib/lib/libta_lib.dylib: Mach-O 64-bit dynamically linked shared library arm64
do i have arm64 python
➜ ~ file $(which python3.13)
/opt/homebrew/bin/python3.13: Mach-O 64-bit executable arm64
install the arm64 python ta-lib
➜ ~ python3.13 -m pip install ta-lib
or use a venv
python3.13 -m venv path/to/venv
source path/to/venv/bin/activate
python3.13 -m pip install ta-lib
This message /Users/ja**/.zprofile
makes me think you need to edit your ~/.zprofile
to change it to refer to /opt/homebrew/bin/brew
Note: it is possible for you to run intel python with intel brew with intel ta-lib on apple silicon mac. it just requires keeping your environment consistent.
unless you need a mixed environment (which i do for different dev reasons), i suggest going all apple silicon and removing the intel libraries and python's you used to use.
And you might want to uninstall old ta-lib python first python3.13 -m pip uninstall ta-lib
... if it was compiled earlier to just make sure it's reinstalled...
.zprofile updated but hasn't fixed the '_TA_ACOS' issue.
Unfortunately i am moving all my python packages to Arm64 as i was having other issues trying to operate the intel python and im now making the effort to get it all running correctly on arm64.
is there a way to dirrectly address the import error?
ImportError: dlopen(/Users/ja***/opt/anaconda3/lib/python3.12/site-packages/talib/_ta_lib.cpython-312-darwin.so, 0x0002): symbol not found in flat namespace '_TA_ACOS'
my bashprofile is still reading
PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}" export PATH
do you think this could be the issue?
The bash message seems to relate to system python 3.9, but your install is anaconda python 3.12.
In this case, I personally would probably delete ~/opt/anaconda3/lib/python3.12/site-packages/talib
directory and then try and re-install it, making sure that I didn't have any issues with an old export of TA_LIBRARY_PATH
or TA_INCLUDE_PATH
pointing to an old C library.
If you're sure that ~/opt/anaconda/bin/python3.12
is arm64, and sure that brew is arm64, and sure that brew install ta-lib is arm64, then the last step is making sure that you do ~/opt/anaconda/bin/python3.12 -m pip install ta-lib
and have it compile properly as arm64.
Then test it with
$ ~/opt/anaconda/bin/python3.12
Python 3.12.7 (main, Oct 1 2024, 02:05:46) [Clang 16.0.0 (clang-1600.0.26.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import talib
>>> print(talib.__version__)
Unfortunately i just could not get it to work.
All packages have been installed correctly with the correct arm64 all bash and zsh profile are correct but i still get the '_TA_ACOS' error.
It seems to be the only package that is having issues installing so i have decided to migrate to btalib which is working.
hope others manage to get it sorted, thanks for your help @mrjbq7
My best guess is your anaconda python is still intel, but I'm not sure.
$ file ~/opt/anaconda/bin/python3.12
I have recently changed to an M3 mac and i am struggling to get TA-Lib to install correctly.
I have uninstalled and reinstalled TA-Lib multiple times now.
I first performed un-installs as follow: brew uninstall ta-lib pip uninstall ta-lib
Then I followed the instructions in the ReadMe: arch -arm64 brew install ta-lib export TA_INCLUDE_PATH="$(brew --prefix ta-lib)/include" export TA_LIBRARY_PATH="$(brew --prefix ta-lib)/lib" pip install TA-Lib
ERROR: symbol not found in flat namespace '_TA_ACOS'
I think the issue is TA-Lib C Library is not arm64
Comand: file $(brew --prefix ta-lib)/lib/libta_lib.dylib Returns: Mach-O 64-bit dynamically linked shared library x86_64
while everything else is running on arm64, i just cant work out how to switch the C library to arm64 i have tried so many different un/reinstall suggestions from the online forums and have had no luck.
thanks in advance