#3525·mlc-llm

[Doc] Build from source instructions incomplete - missing Python environment setup and library path configuration

Author: farukerdem34Created Jul 23, 2026Updated Jul 23, 2026
Labelsdocumentation

Documentation

Suggestion

The current build-from-source documentation lacks several critical setup steps, particularly regarding Python environment configuration and library path management. The guide assumes the build artifacts will be automatically discoverable by Python, which is not the case. I recommend adding explicit instructions for:

  1. Installing required Python dependencies (apache-tvm-ffi, numpy, etc.)
  2. Setting up PYTHONPATH and DYLD_LIBRARY_PATH/LD_LIBRARY_PATH
  3. Verifying the TVM installation before testing MLC-LLM
  4. Troubleshooting common runtime errors

Bug

  1. Missing TVM Python package: The guide mentions "TVM's Python package needs to be in PYTHONPATH" but doesn't specify that apache-tvm-ffi must be installed via pip, nor does it show the correct PYTHONPATH configuration for the local TVM build.

  2. Missing library path configuration: Even after setting PYTHONPATH, the system fails to find libtvm_runtime.dylib (on macOS) because DYLD_LIBRARY_PATH is not set. The documentation doesn't mention this at all.

  3. Missing numpy dependency: The TVM import fails with ModuleNotFoundError: No module named 'numpy' - this is not listed as a requirement in the documentation.

  4. Runtime malloc error: After fixing all path issues and dependencies, the command python -m mlc_llm -h crashes with:

    malloc: *** error for object 0x600001720008: pointer being freed was not allocated

    This suggests a more serious issue that the documentation cannot help resolve. The user is left stuck at the final step.

Suggested Resolution:

  • Add comprehensive post-build setup instructions covering:
    bash
    pip install numpy apache-tvm-ffi
    export PYTHONPATH=$PWD/3rdparty/tvm/python:$PWD/python:$PYTHONPATH
    export DYLD_LIBRARY_PATH=$PWD/build/lib:$DYLD_LIBRARY_PATH  # macOS
    # or export LD_LIBRARY_PATH=$PWD/build/lib:$LD_LIBRARY_PATH  # Linux
  • Add verification steps to test the installation incrementally:
    python -c "import tvm; print(tvm.__version__)"
    python -c "from mlc_llm import MLCEngine"
  • Note the minimum required Python version and potential compatibility issues
  • The malloc error indicates either a version mismatch between the compiled libraries and the Python package, or a build configuration issue that should be documented as a known issue with a workaround