Docker image ghcr.io/morphik-org/morphik-core:latest exits on startup with ModuleNotFoundError: No module named 'utils'
Summary
When deploying Morphik via the official Docker installer (install_docker.sh) using the prebuilt image, both morphik (API) and worker containers exit immediately with:
ModuleNotFoundError: No module named 'utils'
The traceback originates from /app/core/config.py importing:
from utils.env_loader import load_local_env
Inspecting the published image shows /app/utils is missing and env_loader.py cannot be found anywhere under /app, so the import is impossible.
Environment
- Host OS: Ubuntu 24.04.3 LTS (noble)
- Docker: 29.1.2
- Docker Compose: v5.0.0
- Install method:
install_docker.sh (quick start / prebuilt image)
- GPU: NVIDIA L40S (Driver 580.82.07) (likely unrelated; repro happens before the API is up)
Optional: paste the image digest
docker image inspect ghcr.io/morphik-org/morphik-core:latest --format '{{index .RepoDigests 0}}'
Steps to reproduce
-
On a clean host with Docker + Docker Compose:
mkdir -p /opt/morphik-core && cd /opt/morphik-core
curl -sSL https://raw.githubusercontent.com/morphik-org/morphik-core/main/install_docker.sh | bash
-
Complete installer prompts (in my case: embeddings via Ollama; failure happens before the API comes up).
-
Start the stack:
docker compose -f docker-compose.run.yml --profile ui --profile ollama up -d --remove-orphans
-
Observe container status:
docker compose -f docker-compose.run.yml ps -a
morphik and worker exit with code 1.
Expected behavior
Actual behavior
morphik logs
Traceback (most recent call last):
File "/app/start_server.py", line 15, in <module>
from core.config import get_settings
File "/app/core/config.py", line 9, in <module>
from utils.env_loader import load_local_env
ModuleNotFoundError: No module named 'utils'
worker logs
Traceback (most recent call last):
...
File "/app/core/config.py", line 9, in <module>
from utils.env_loader import load_local_env
ModuleNotFoundError: No module named 'utils'
Investigation (inside the published image)
/app/utils is missing
docker run --rm --entrypoint /bin/sh ghcr.io/morphik-org/morphik-core:latest -lc \
'ls -la /app/utils || echo "MISSING /app/utils"'
env_loader.py cannot be found anywhere
docker run --rm --entrypoint /bin/sh ghcr.io/morphik-org/morphik-core:latest -lc \
'find /app -maxdepth 6 -name "env_loader.py" -print'
Additionally, /app/core/utils exists, suggesting a possible import-path mismatch or packaging omission.
Impact
This blocks the Docker “quick start” deployment: the API never comes up and Morphik is unusable unless patched locally.
Workaround (used to unblock)
Bind-mount a minimal utils/env_loader.py into the containers at /app/utils so the import succeeds.
Important: Morphik calls load_local_env(..., override=True), so the function must accept an override kwarg.
Workaround requirements:
- Provide
/app/utils/env_loader.py
- Implement
load_local_env(path=None, override: bool = False, **kwargs)
Suspected root cause
The published latest image appears to be built without the top-level Python package utils (or at least without utils/env_loader.py), while runtime imports in /app/core/config.py still depend on it.
Suggested fix
-
Ensure the published Docker image contains the expected module path for utils.env_loader, or update imports consistently to the correct location (e.g., core.utils...) if the package was moved/refactored.
-
Add a build-time sanity check in the image pipeline:
python -c "from core.config import get_settings"
Attachments
morphik-git-bug.pdf
Docker image
ghcr.io/morphik-org/morphik-core:latestexits on startup withModuleNotFoundError: No module named 'utils'Summary
When deploying Morphik via the official Docker installer (
install_docker.sh) using the prebuilt image, bothmorphik(API) andworkercontainers exit immediately with:The traceback originates from
/app/core/config.pyimporting:Inspecting the published image shows
/app/utilsis missing andenv_loader.pycannot be found anywhere under/app, so the import is impossible.Environment
install_docker.sh(quick start / prebuilt image)Steps to reproduce
On a clean host with Docker + Docker Compose:
Complete installer prompts (in my case: embeddings via Ollama; failure happens before the API comes up).
Start the stack:
Observe container status:
morphikandworkerexit with code 1.Expected behavior
morphikandworkerstay running.API responds:
Actual behavior
morphiklogsworkerlogsInvestigation (inside the published image)
/app/utilsis missingdocker run --rm --entrypoint /bin/sh ghcr.io/morphik-org/morphik-core:latest -lc \ 'ls -la /app/utils || echo "MISSING /app/utils"'env_loader.pycannot be found anywheredocker run --rm --entrypoint /bin/sh ghcr.io/morphik-org/morphik-core:latest -lc \ 'find /app -maxdepth 6 -name "env_loader.py" -print'Impact
This blocks the Docker “quick start” deployment: the API never comes up and Morphik is unusable unless patched locally.
Workaround (used to unblock)
Bind-mount a minimal
utils/env_loader.pyinto the containers at/app/utilsso the import succeeds.Important: Morphik calls
load_local_env(..., override=True), so the function must accept anoverridekwarg.Workaround requirements:
/app/utils/env_loader.pyload_local_env(path=None, override: bool = False, **kwargs)Suspected root cause
The published
latestimage appears to be built without the top-level Python packageutils(or at least withoututils/env_loader.py), while runtime imports in/app/core/config.pystill depend on it.Suggested fix
Ensure the published Docker image contains the expected module path for
utils.env_loader, or update imports consistently to the correct location (e.g.,core.utils...) if the package was moved/refactored.Add a build-time sanity check in the image pipeline:
python -c "from core.config import get_settings"Attachments
morphik-git-bug.pdf