Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctranslate2 4.5.0 not available for x86_64 macOS #1841

Open
gernophil opened this issue Jan 7, 2025 · 5 comments
Open

Ctranslate2 4.5.0 not available for x86_64 macOS #1841

gernophil opened this issue Jan 7, 2025 · 5 comments

Comments

@gernophil
Copy link

gernophil commented Jan 7, 2025

I am trying to install Ctranslate2 4.5.0 for Intel Macs, but I can only install 4.3.1 via pip:

x86_64 (via Rosetta):

% python -m venv ~/venv/test_x86_64 # using python 3.12.8
% source ~/venv/test_x86_64/bin/activate
% pip install ctranslate2 # using pip 24.3.1
% pip freeze
ctranslate2==4.3.1
numpy==2.2.1
PyYAML==6.0.2
setuptools==75.7.0

With arm64 everything works as expected:

% python -m venv ~/venv/test_arm64 # using python 3.12.8
% source ~/venv/test_arm64/bin/activate
% pip install ctranslate2 # using pip 24.3.1
% pip freeze
ctranslate2==4.5.0
numpy==2.2.1
PyYAML==6.0.2
setuptools==75.7.0

Is there a reason Ctranslate2 is not provided for Intel Macs and do I have to build from source myself?

EDIT: The docs state support for both macOS architectures (x86_64 and arm64):

The Python wheels have the following requirements:

  • OS: Linux (x86-64, AArch64), macOS (x86-64, ARM64), Windows (x86-64)

I also tried pip index versions ctranslate2 and it clearly states for x86_64 only version 4.3.1 and older are available. Is there a pip wheel missing?

@tuanvu92
Copy link

tuanvu92 commented Jan 9, 2025

In my case, I'm using an Intel-based MacBook and I have to build from source to use ctranslate2==4.5.0. You can refer to the script python/tools/prepare_build_environement_macos.sh for instruction.

@gernophil
Copy link
Author

gernophil commented Jan 9, 2025

Thanks for the help. Do you know if this will install the intel MKL package and the OneDNN globally? For OneDNN is doesn't look like, but for MKL I am not sure.

And from what wd would I need to execute this script?

Is there any statement, if the wheel for Intel Macs was dropped or was it just forgotten?

@tuanvu92
Copy link

tuanvu92 commented Jan 9, 2025

If you run the script, error will appear as some ULRs were expired. I manually installed Intel MKL 2023.2.0 and OneDNN by myself.

wget https://registrationcenter-download.intel.com/akdlm/IRC_NAS/cd013e6c-49c4-488b-8b86-25df6693a9b7/m_BaseKit_p_2023.2.0.49398.dmg
hdiutil attach -noverify -noautofsck m_BaseKit_p_2023.2.0.49398.dmg
sudo /Volumes/m_BaseKit_p_2023.2.0.49398/bootstrapper.app/Contents/MacOS/bootstrapper --silent --eula accept --components intel.oneapi.mac.mkl.devel

For OneDNN, I downloaded from their repo and compile it.

After that you can compile ctranslate2 by the following command. Make sure -DWITH_DNNL=ON or the quantized model will not work properly:

mkdir build-release && cd build-release
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_CLI=OFF -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON -DWITH_DNNL=ON ..
VERBOSE=1 make -j2 install

@gernophil
Copy link
Author

Seems like MKL and OneDNN are available via conda. I'll try that first to make sure none of them set any system wide parameters, since Ia m working on an arm64 machine and only need the x86_64 package to compile an intel binary later in the process.

@gernophil
Copy link
Author

Haven't tried my luck yet. I am still trying to figure out a good way without installing MKL globally. Do you happen to know, if I need MKL at all for Ctranslate2 or Dino maybe only need need to compile oneDNN?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants