tensorflow / tensorflow/model-optimization
build from source fails on macos
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.6k
- Forks
- 349
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 1
Description
Describe the bug
Running pip install . on macOS fails with the following error:
running build_py
creating build/lib/tensorflow_model_optimization
error: could not create 'build/lib/tensorflow_model_optimization': Not a directory
System information
- Operating System: macOS
- File system: Case-insensitive (default macOS file system)
Root cause
macOS uses a case-insensitive file system by default.
In the repository root, there is a file named BUILD. During the pip install . process, pip attempts to create a directory named build.
Because BUILD and build are treated as the same path on a case-insensitive file system, directory creation fails.
Workaround
Building and installing the package via Bazel works correctly:
git clone https://github.com/tensorflow/model-optimization.git
cd model-optimization
bazel build --copt=-O3 --copt=-march=native :pip_pkg
PKGDIR=$(mktemp -d)
./bazel-bin/pip_pkg "$PKGDIR"
python -m pip install --upgrade "$PKGDIR"/*.whl
Expected behavior
pip install . should succeed on macOS without requiring a Bazel-based workaround.
Additional notes
This issue appears to be specific to case-insensitive file systems and may not reproduce on Linux or on macOS systems configured with a case-sensitive file system.
Contributor 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.
Research direction
Start by reproducing pip install . on a case-insensitive macOS file system and inspect the repository-root BUILD file involved in the name collision. Compare the package build path with the Bazel workaround; done means the package installs successfully with pip install . without requiring Bazel.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100