PyPI sdist missing C++ source — cannot build native libraries from source
Maintainers usually reply within 5 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 58/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- build-system
Research direction
Start with setup.py, MANIFEST.in, CMakeLists.txt, and the PEP 517 build configuration, then reproduce the failure with pip install --no-binary coremltools from the sdist. Verify that the sdist contains the listed C++ source directories, that installation builds the native libraries, and that the provided model-conversion command no longer raises BlobWriter not loaded.
Written by the indexing model from the issue text.
Description
🐞Describing the bug
The PyPI source distribution (sdist) does not include the C++ source directories needed to build the native libraries (libmilstoragepython, libmodelpackage, kmeans1d/_core). Building from the sdist produces a wheel without these libraries, so model conversion crashes at runtime.
The Git repository contains everything needed — CMakeLists.txt, deps/, mlmodel/, cmake/, modelpackage/, milstoragepython/ — but these are excluded from the sdist tarball. The setup.py packages the resulting .so files via package_data, but since the CMake build never runs during pip install, they don't exist.
Stack Trace
WARNING: No module named 'coremltools.libmilstoragepython'
WARNING: No module named 'coremltools.libcoremlpython'
RuntimeError: BlobWriter not loaded
To Reproduce
pip install coremltools --no-binary coremltools
python -c "
import coremltools as ct
import torch
model = torch.nn.Linear(10, 5)
traced = torch.jit.trace(model, torch.randn(1, 10))
ct.convert(traced) # RuntimeError: BlobWriter not loaded
"
System environment (please complete the following information):
- coremltools version: 8.3 and 9.0 (likely all versions)
- OS (e.g. MacOS version or Linux type): Linux x86_64 (RHEL 9), but affects any platform when building from sdist
- Any other relevant version information (e.g. PyTorch or TensorFlow version): Python 3.12, PyTorch 2.6.0
Additional context
Building from the Git repository with CMake works perfectly — all three native libraries compile and model conversion succeeds. The published wheels on PyPI (both macOS and manylinux) include the native libraries and work fine — the issue is only with the sdist.
The fix would be to include the C++ source directories in MANIFEST.in (or equivalent) and wire the CMake build into the PEP 517 build backend so pip install from the sdist produces a working package.
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 854
- Avg merge
- 8d 2h
- Merged PRs (30d)
- 8
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apple/coremltools
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
apple/coremltools#2874 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apple/coremltools#2826 · 2 comments ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apple/coremltools#2728 ·
Maintainers usually reply within 5 days
-
FP8 support?Openquestion
Difficulty 5/5 Over a week Newbie friendliness 35/100
apple/coremltools#2860 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
apple/coremltools#2853 ·
Maintainers usually reply within 5 days
All issues in apple/coremltools
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
instance instance add
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
searxng/searx-instances#941 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
FluidNumerics/fluid-walk-blocker#89 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day