Skip to content

Docker image ghcr.io/morphik-org/morphik-core:latest exits on startup with ModuleNotFoundError: No module named 'utils' (missing /app/utils and utils.env_loader) #309

@darconada

Description

@darconada

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

  1. 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
  2. Complete installer prompts (in my case: embeddings via Ollama; failure happens before the API comes up).

  3. Start the stack:

    docker compose -f docker-compose.run.yml --profile ui --profile ollama up -d --remove-orphans
  4. Observe container status:

    docker compose -f docker-compose.run.yml ps -a

    morphik and worker exit with code 1.

Expected behavior

  • morphik and worker stay running.

  • API responds:

    curl http://127.0.0.1:8000/health

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions