Error compiling model: "Failed to create a working directory appropriate for URL: ..."
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 850
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 10
Description
## 🐞Describing the bug
- This is likely not an issue in `coremltools` (rather the underlying OS), but the issue arises when using `coremltools`
- I am raising this issue as both:
- A **hacky fix** which can be used by anyone encountering this issue
- A **call for help**, I won't bother to open a ticket on the Apple Developer forums at this time since most people who encounter this issue should hit it through `coremltools`
## Stack Trace
- I no longer have access to the full stack trace. The relevant message is as follows:
```bash
RuntimeWarning: You will not be able to run predict() on this Core ML model. Underlying exception message was: Error compiling model: "Failed to create a working directory appropriate for URL: file:///var/folders/ ...
```
## To Reproduce
- Running inference on these models cause Mac storage (`com.apple.aned` folder) to slowly fill
- This folder will not show up or in `du`/`ncdu` natively
- In my case, I have 512GB of local storage and the `com.apple.aned` folder occupied 274GB
## System environment (please complete the following information):
- coremltools version: 8.3.0
- OS (e.g. MacOS version or Linux type): Sequoia 15.5
- Any other relevant version information (e.g. PyTorch or TensorFlow version): PyTorch 2.7.1
## Additional context
### The Fix
- Disable System Integrity Protection (SIP, [tutorial](https://developer.apple.com/documentation/security/disabling-and-enabling-system-integrity-protection#Disable-System-Integrity-Protection-Temporarily))
- Boot into recovery mode
- From the top bar, Utilities -> Terminal
- Run the command `csrutil disable`
- Reboot and login normally
- The `com.apple.aned` folder should now appear in the `ncdu` index (it should be easy to find if it's large) and can be deleted at root level
- Re-enable SIP
Contributor guide
Research direction
No source file or test is named, and the full stack trace is unavailable. Start by reproducing inference with coremltools 8.3.0 and PyTorch 2.7.1 on macOS Sequoia 15.5, then trace the reported model-compilation failure and com.apple.aned storage growth. Done means identifying an actionable project-side cause or documenting that the behavior is outside coremltools.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, python, pytorch
- Domain
- machine-learning, operating-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100