Package Details: python-ctranslate2 4.8.3-1

Git Clone URL: https://aur.archlinux.org/ctranslate2.git (read-only, click to copy)
Package Base: ctranslate2
Description: A Python library for efficient inference with Transformer models.
Upstream URL: https://github.com/OpenNMT/CTranslate2
Licenses: MIT
Submitter: yochananmarqos
Maintainer: lubosz (rubin55)
Last Packager: rubin55
Votes: 6
Popularity: 0.28
First Submitted: 2023-12-10 15:32 (UTC)
Last Updated: 2026-10-14 09:35 (UTC)

Sources (6)

Latest Comments

1 2 3 Next › Last »

lubosz commented on 2026-10-14 09:38 (UTC)

@rubin55: thanks for looking into it. feel free to improve the package. make sure it builds with pkgctl build. It should run without any issues since we don't have AUR deps.

rubin55 commented on 2026-10-14 09:16 (UTC) (edited on 2026-10-14 09:34 (UTC) by rubin55)

@lubosz Thanks for adding me as co-maintainer! I'll be pushing some updates w/regards to dependencies and layout of the PKGBUILD; There are a bunch of unused dependencies and the cuda stuff is now provided by ctranslate2-cuda. Feel free to change/adjust if you see further improvements/issues.

lubosz commented on 2026-10-14 08:26 (UTC) (edited on 2026-10-14 08:39 (UTC) by lubosz)

Thanks for all the input, updated to 4.8.3. Some submodules needed updating, as well as the pybind workaround. Veryfied with pkgbuild.

@rubin55: Added you as Co-Maintainer.

rubin55 commented on 2026-10-08 09:11 (UTC) (edited on 2026-10-08 09:13 (UTC) by rubin55)

I recently published ctranslate2-cuda. While working on that I also refactored this package quite a bit. Maybe my resultant PKGBUILD will be of use to the maintainer of this package and/or its users:

# Maintainer: Lubosz Sarnecki <lubosz@gmail.com>
# Contributor: Mark Wagie <mark dot wagie at proton dot me>

pkgname=(
  'ctranslate2'
  'python-ctranslate2'
)
pkgbase=ctranslate2
pkgver=4.8.2
pkgrel=1
pkgdesc="A C++ and Python library for efficient inference with Transformer models."
arch=('x86_64')
url="https://github.com/OpenNMT/CTranslate2"
license=('MIT')
makedepends=(
  'cmake'
  'ninja'
  'git'
  'openblas'
  'pybind11'
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-wheel'
)
source=("git+https://github.com/OpenNMT/CTranslate2.git#tag=v$pkgver"
        'git+https://github.com/jarro2783/cxxopts.git'
        'git+https://github.com/google/cpu_features.git'
        'git+https://github.com/gabime/spdlog.git'
        'git+https://github.com/google/ruy.git'
        'git+https://github.com/pytorch/cpuinfo.git')
sha256sums=('3ebe3d22a615f1b04710e19aa7d94c26c704bdd1e3ed3b3d31f7f7e77dfc2ebd'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')

prepare() {
  cd CTranslate2
  for submodule in cxxopts cpu_features spdlog ruy; do
    git submodule init "third_party/${submodule}"
    git config submodule."third_party/${submodule}".url "$srcdir/${submodule}"
  done
  git -c protocol.file.allow=always submodule update

  pushd third_party/ruy
  git submodule init third_party/cpuinfo
  git config submodule."cpuinfo".url "$srcdir/cpuinfo"
  git -c protocol.file.allow=always submodule update
  popd

  git clean python -dfx

  # Relax pybind11 version
  sed -i 's/pybind11==2.11.1/pybind11/g' python/pyproject.toml

  # Remove the /usr/local RUNPATH from the Python extension
  sed -i '/-Wl,-rpath/d' python/setup.py
}

build() {
  local cmake_options=(
    -B build
    -G Ninja
    -S CTranslate2
    -W no-dev
    -D CMAKE_BUILD_TYPE='RelWithDebInfo'
    -D CMAKE_INSTALL_PREFIX='/usr'
    -D OPENMP_RUNTIME='COMP'
    -D WITH_MKL='OFF'
    -D WITH_DNNL='OFF'
    -D WITH_OPENBLAS='ON'
    -D OPENBLAS_INCLUDE_DIR='/usr/include/openblas'
    -D WITH_RUY='ON'
    -D CMAKE_POLICY_VERSION_MINIMUM='3.5'
  )
  cmake "${cmake_options[@]}"
  cmake --build build

  pushd CTranslate2/python
  CTRANSLATE2_ROOT=.. LIBRARY_PATH="$srcdir/build" python -m build --wheel --no-isolation
  popd
}

package_ctranslate2() {
  pkgdesc="A C++ library for efficient inference with Transformer models."
  depends=(
    'openblas'
    'libgcc'
    'libstdc++'
    'libgomp'
    'glibc'
  )

  DESTDIR="$pkgdir" cmake --install build

  # Avoid conflict with nlohmann-json
  rm -r "$pkgdir/usr/include/nlohmann"

  install -Dm644 CTranslate2/LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}

package_python-ctranslate2() {
  pkgdesc="A Python library for efficient inference with Transformer models."
  depends=(
    'ctranslate2'
    'python-numpy'
    'python-yaml'
    'python'
    'libgcc'
    'glibc'
    'libstdc++'
  )
  optdepends=(
    'python-pytorch: model converters'
    'python-transformers: Hugging Face model converter'
  )

  cd CTranslate2/python
  python -m installer --destdir="$pkgdir" dist/*.whl

  install -Dm644 ../LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}

gefyrotos commented on 2025-10-02 04:08 (UTC)

In case this helps someone else with an RTX 3060 who wants to use CUDA 13.0, here's my modified PKGBUILD:

@@ -14,7 +14,7 @@
 makedepends=(
   'cmake'
   'cuda'
-#  'cudnn'
+  'cudnn'
   'gcc14'
   'git'
   'intel-oneapi-mkl'
@@ -96,8 +96,9 @@
     -DOPENBLAS_INCLUDE_DIR='/usr/include/openblas' \
     -DWITH_RUY='ON' \
     -DWITH_CUDA='ON' \
+    -DWITH_CUDNN='ON' \
     -DCUDA_DYNAMIC_LOADING='ON' \
-    -DCUDA_ARCH_LIST='Common' \
+    -DCUDA_NVCC_FLAGS="-gencode arch=compute_86,code=sm_86" \
     -DCMAKE_POLICY_VERSION_MINIMUM='3.5' \
     -DENABLE_CPU_DISPATCH='OFF' \
     -Wno-dev

The arch=compute_86 refers to the compute capability of the 3060, which is 8.6.

xuhcc commented on 2025-07-18 13:15 (UTC)

ctranslate2 package currently depends on gcc13 from AUR. Is it still necessary? I tried to build the package with gcc14, that seems to work too.

yochananmarqos commented on 2025-07-18 00:49 (UTC)

@techmanwalker: First of all, English please. In the future, please prefix output with LC_ALL=C.

Do you have some sort of local environment variable that overrides the default linker? Notice this package neither uses mold nor lld.

lito commented on 2025-07-18 00:42 (UTC)

ld.mold: /usr/src/debug/mold/mold/src/mold.h:3556: mold::i64 mold::Symbol<E>::get_output_sym_idx(mold::Context<E>&) const [with E = mold::X86_64; mold::i64 = long int]: Assertion `i != -1' failed.
collect2: error fatal: se terminó ld con la señal 6 [Abortado], core dumped
compilación terminada.
make[2]: *** [CMakeFiles/ctranslate2.dir/build.make:2191: libctranslate2.so.4.6.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:391: CMakeFiles/ctranslate2.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

yochananmarqos commented on 2025-04-14 22:48 (UTC)

@taba: Can't reproduce. Make sure you're not mixing local and system Python packages.

taba commented on 2025-04-14 21:37 (UTC)

==> Starting package_python-ctranslate2()... usage: python -m installer [-h] [--destdir path] [--prefix path] [--compile-bytecode level] [--no-compile-bytecode] wheel python -m installer: error: unrecognized arguments: dist/ctranslate2-4.6.0-cp313-cp313-linux_x86_64.whl