Hello Daun (Daniel) Lee,
Welcome to Microsoft Q&A.
Thank you for sharing the details and all the paths you’ve already tried. What you’re seeing is expected behavior in Azure Machine Learning (AML) notebooks. The issue occurs because SQLite requires exclusive file-locking, but many directories in AML notebooks are FUSE-mounted or shared, which prevents SQLite/Chroma from acquiring the lock causing the cell to run indefinitely.
Below is the recommended guidance, combining troubleshooting steps and correct AML filesystem behavior:
Where SQLite / Chroma can successfully write in AML
1. User workspace directory
Supports SQLite locking and appears in Notebook Explorer.
Use this path format:
/home/azureuser/cloudfiles/code/Users/<your-username>/chroma_db
Example code:
import os
persist_directory = "/home/azureuser/cloudfiles/code/Users/<your-username>/chroma_db"
os.makedirs(persist_directory, exist_ok=True)
db = Chroma.from_documents(
docs,
emb,
persist_directory=persist_directory
)
SQLite locking works, Visible in AML UI, Persistent across compute restarts
2. Local SSD ephemeral storage
/mnt/azureml/cr/
Fast, Locking supported, not visible in UI, not persistent
Directories where SQLite will NOT work
These paths are FUSE-mounted → SQLite file-locking fails:
./chroma_db
~/chroma_db
/home/azureuser/cloudfiles/... (certain internal subfolders)
/mnt/batch/tasks/...
/home/azureuser root
/tmp
Notebook mount paths inside /mnt/.../code/...
These cause your cell to "hang" because SQLite waits forever on a lock.
Troubleshooting & Best Practices
(Merged from your list + correct AML behavior)
Ensure the folder exists
os.makedirs("chroma_db", exist_ok=True)
Make sure no other process holds a lock
If another notebook/cell is using the same SQLite DB, Chroma may hang.
Try saving locally then moving
Save in /mnt/azureml/cr/ first, then move into cloudfiles if needed.
Validate permissions
Use only directories where your workspace user has write access.
Check known Azure ML notebook issues
Some updates temporarily affect write behavior on mounted paths.
Consider ADLS for persistence
If long-term durability is needed, you can export the Chroma folder to ADLS after creation.
Consider DuckDB if issues continue
DuckDB handles cloud-mounted filesystems better than SQLite.
Recommended Solution
Use the workspace-visible directory the only one that meets all your requirements:
Path:
/home/azureuser/cloudfiles/code/Users/<your-username>/chroma_db
Code:
import os
persist_directory = "/home/azureuser/cloudfiles/code/Users/<your-username>/chroma_db"
os.makedirs(persist_directory, exist_ok=True)
db = Chroma.from_documents(
docs,
emb,
persist_directory=persist_directory
)
This ensures:
SQLite writes succeed, no locking issues, Folder appears in AML Notebooks UI, fully persistent.
I Hope this helps. Do let me know if you have any further queries.
Thank you!