VOOZH about

URL: https://aur.archlinux.org/packages/python-rapidocr

⇱ AUR (en) - python-rapidocr


Arch Linux User Repository

Search Criteria

Package Details: python-rapidocr 3.9.0-1

Git Clone URL: https://aur.archlinux.org/python-rapidocr.git (read-only, click to copy)
Package Base: python-rapidocr
Description: Cross-runtime OCR library
Upstream URL: https://github.com/RapidAI/RapidOCR
Licenses: Apache-2.0
Submitter: aliu
Maintainer: aliu
Last Packager: aliu
Votes: 1
Popularity: 0.018917
First Submitted: 2025-11-30 02:14 (UTC)
Last Updated: 2026-06-24 20:20 (UTC)

Sources (5)

Pinned Comments

aliu commented on 2026-06-24 20:20 (UTC) (edited on 2026-06-24 20:20 (UTC) by aliu)

You may notice that the official repositories have yet to package python-installer 1.0.1+. We require that version due to a bug that blocks upgrades, related to symlinks.

To get this package to build, simply bump python-installer yourself:

  1. Fetch the PKGBUILD for python-installer. You can do this through a helper (e.g. paru -G python-installer) or by simple cloning (git clone https://gitlab.archlinux.org/archlinux/packaging/packages/python-installer.git).
  2. Open the PKGBUILD file and change line 8 to pkgver=1.0.1. Replace line 39 with b2sums=('9101f90e108894c675b605123a372b45b43b4720fb1ac2eee18ea15d7759e8e1e0adeccc0da006fb3bba25e5094310158206182527ff82249a3aecacf08fcb39') (or update the checksum yourself).
  3. cd to the directory for python-installer's PKGBUILD and run makepkg -si.

Latest Comments

1 2 Next › Last »

aliu commented on 2026-06-24 20:20 (UTC) (edited on 2026-06-24 20:20 (UTC) by aliu)

You may notice that the official repositories have yet to package python-installer 1.0.1+. We require that version due to a bug that blocks upgrades, related to symlinks.

To get this package to build, simply bump python-installer yourself:

  1. Fetch the PKGBUILD for python-installer. You can do this through a helper (e.g. paru -G python-installer) or by simple cloning (git clone https://gitlab.archlinux.org/archlinux/packaging/packages/python-installer.git).
  2. Open the PKGBUILD file and change line 8 to pkgver=1.0.1. Replace line 39 with b2sums=('9101f90e108894c675b605123a372b45b43b4720fb1ac2eee18ea15d7759e8e1e0adeccc0da006fb3bba25e5094310158206182527ff82249a3aecacf08fcb39') (or update the checksum yourself).
  3. cd to the directory for python-installer's PKGBUILD and run makepkg -si.

aliu commented on 2026-06-24 18:46 (UTC)

@papakilo I've traced that issue down to two things:

  1. If you don't clean the srcdir, you'll end up with multiple .whl-s, which try to install over each other as all are included under dist/*.whl .
  2. python-installer v1.0.0 has a bug (fixed in v1.0.1, which Arch has not packaged) where it resolves symlinks when determining whether a path is safe. The solution is to remove (your system's, not $pkgdir's) /usr/lib/python*/site-packages/rapidocr/config.yaml before package(). I'll see what I can do.

aliu commented on 2026-06-22 01:51 (UTC)

I somehow forgot that optional dependencies aren't installed by default. How rapidocr works is that you can configure it to use any one of six runtime and the default config uses onnxruntime. Not sure what's the best way to reflect that in the PKGBUILD.

musta_ruhtinas commented on 2026-06-21 16:46 (UTC) (edited on 2026-06-21 16:47 (UTC) by musta_ruhtinas)

@aliu I would have thought so myself, but no, adding onnxruntime-cpu to the array results in the same error.

EDIT: onnxruntime not needed, python-onnxruntime not optional; building fine afterwards.

aliu commented on 2026-06-21 15:06 (UTC) (edited on 2026-06-21 15:06 (UTC) by aliu)

@musta_ruhtinas Interesting, Wild guess but does installing onnxruntime fix that? I'll test later.

@papakilo That introduces a divergence with the upstream build recipe. I do not like how "bypassing installer path validation" sounds. If this is a security feature, it must be there for a reason. I don't want to do so until I figure out how this validation works.

You may also want to pin python-installer>=0.7

This is just wrong; that does not "pin" the version.

musta_ruhtinas commented on 2026-06-20 09:04 (UTC) (edited on 2026-06-20 09:04 (UTC) by musta_ruhtinas)

building fails in a clean chroot with an error when checking for onnxruntime, but python-onnxruntime-cpu is installed before building

<frozen runpy>:130: RuntimeWarning: 'rapidocr.main' found in sys.modules after import of package 'rapidocr', but prior to execution of 'rapidocr.main'; this may result in unpredictable behaviour
[INFO] 2026-06-20 08:44:25,639 [RapidOCR] base.py:22: Using engine_name: onnxruntime
Traceback (most recent call last):
 File "<frozen runpy>", line 203, in _run_module_as_main
 File "<frozen runpy>", line 88, in _run_code
 File "/build/python-rapidocr/src/RapidOCR-3.8.4/python/build/lib/rapidocr/main.py", line 489, in <module>
 main()
 ~~~~^^
 File "/build/python-rapidocr/src/RapidOCR-3.8.4/python/build/lib/rapidocr/main.py", line 441, in main
 ocr_engine = RapidOCR(params=params)
 File "/build/python-rapidocr/src/RapidOCR-3.8.4/python/build/lib/rapidocr/main.py", line 46, in __init__
 self._initialize(cfg)
 ~~~~~~~~~~~~~~~~^^^^^
 File "/build/python-rapidocr/src/RapidOCR-3.8.4/python/build/lib/rapidocr/main.py", line 71, in _initialize
 self.text_det = TextDetector(cfg.Det)
 ~~~~~~~~~~~~^^^^^^^^^
 File "/build/python-rapidocr/src/RapidOCR-3.8.4/python/build/lib/rapidocr/ch_ppocr_det/main.py", line 47, in __init__
 self.session = get_engine(cfg.engine_type)(cfg)
 ~~~~~~~~~~^^^^^^^^^^^^^^^^^
 File "/build/python-rapidocr/src/RapidOCR-3.8.4/python/build/lib/rapidocr/inference_engine/base.py", line 26, in get_engine
 raise ImportError(f"{engine_type.value} is not installed.")
ImportError: onnxruntime is not installed.
==> ERROR: A failure occurred in check().
 Aborting...
==> ERROR: Build failed

papakilo commented on 2026-06-20 07:43 (UTC)

@aliu Hi, according to a chatbot, the bug is inside the PKGBUILD of python-rapidocr and here's what it suggested to me:

The issue is that python-installer rejects the .onnx model files because they are placed inside the wheel at a path that resolves outside the allowed destination directory under Python 3.14's stricter path validation.

The fix is to install the models manually after python-installer runs, instead of bundling them inside the wheel:

package() {
 cd "${srcdir}/RapidOCR-${pkgver}/python"
 python -m installer --destdir="$pkgdir" dist/*.whl

 # Install model files manually, bypassing installer path validation
 local models_dir="$pkgdir/usr/lib/python3/dist-packages/rapidocr/models"
 install -dm755 "$models_dir"
 install -m644 rapidocr/models/*.onnx "$models_dir/"
}

The root cause: python-build creates a wheel that embeds the .onnx files under a path that python-installer considers outside the target directory tree — this validation became stricter in recent versions of python-installer. Extracting the model installation step from the wheel install avoids the check entirely while still placing the files in the correct location.

You may also want to pin python-installer>=0.7 in makedepends if you want to track which version introduced the stricter validation.

aliu commented on 2026-06-19 17:26 (UTC) (edited on 2026-06-19 17:26 (UTC) by aliu)

No idea what that error means. Are you sure the rest of your system is up-to-date?

papakilo commented on 2026-06-19 10:30 (UTC)

Hi, there are errors during installation:

Successfully built rapidocr-3.8.4-py3-none-any.whl ==> Entro nell'ambiente fakeroot... ==> Avvio di package() in corso... Traceback (most recent call last): File "<frozen runpy>", line 203, in run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/lib/python3.14/site-packages/installer/__main__.py", line 115, in <module> _main(sys.argv[1:], "python -m installer") ~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.14/site-packages/installer/main.py", line 111, in _main installer.install(source, destination, {}) ~^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.14/site-packages/installer/_core.py", line 124, in install record = destination.write_file( scheme=scheme, ...<2 lines>... is_executable=is_executable, ) File "/usr/lib/python3.14/site-packages/installer/destinations.py", line 212, in write_file return self.write_to_fs(scheme, path, stream, is_executable) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.14/site-packages/installer/destinations.py", line 169, in write_to_fs target_path = self._path_with_destdir(scheme, path) File "/usr/lib/python3.14/site-packages/installer/destinations.py", line 143, in _path_with_destdir raise ValueError( f"Attempting to write {path} outside of the target directory" ) ValueError: Attempting to write rapidocr/models/ch_PP-OCRv4_det_mobile.onnx outside of the target directory ==> ERRORE: Si è verificato un errore in package(). L'operazione sta per essere interrotta...

aliu commented on 2026-02-07 03:07 (UTC)

arghhhh rookie mistake, fixed

1 2 Next › Last »

aurweb v6.3.4

Report issues here.

Copyright © 2004-2026 aurweb Development Team.

AUR packages are user produced content. Any use of the provided files is at your own risk.