Skip to content

Base build instructions lead to import error in tests (_mlir_libs._torchMlir not found) #4135

Open
@efric

Description

@efric

Hi folks,

When trying to build torch-mlir following the provided instructions , I ran into unit test failures, specifically

  TORCH_MLIR :: python/fx_importer/basic_test.py
  TORCH_MLIR :: python/fx_importer/custom_op_test.py
  TORCH_MLIR :: python/fx_importer/symbolic_shape_expr_test.py
  TORCH_MLIR :: python/fx_importer/v2.3/auto_functionalized.py
  TORCH_MLIR :: python/fx_importer/v2.3/mutation_import.py
  TORCH_MLIR :: python/fx_importer/v2.3/special_forms_test.py
  TORCH_MLIR :: python/fx_importer/v2.3/types_test.py
  TORCH_MLIR :: python/onnx_importer/BadName.runlit
  TORCH_MLIR :: python/onnx_importer/command_line_test.py
  TORCH_MLIR :: python/onnx_importer/constants.py
  TORCH_MLIR :: python/onnx_importer/function_expansion/GreaterOrEqual.runlit
  TORCH_MLIR :: python/onnx_importer/function_expansion/ReduceSumSquare_keepdims=0.runlit
  TORCH_MLIR :: python/onnx_importer/function_expansion/ReduceSumSquare_no_attrs.runlit
  TORCH_MLIR :: python/onnx_importer/import_onnx_tool.runlit
  TORCH_MLIR :: python/onnx_importer/import_smoke_test.py

All of which stem from

ModuleNotFoundError: No module named 'torch_mlir._mlir_libs._torchMlir'

This occurs with both the base and base + optimization instructions. The issue is resolved by explicitly adding

-DPython_FIND_VIRTUALENV=ONLY

to the CMake invocation (in addition to the existing -DPython3_FIND_VIRTUALENV=ONLY).

If it's helpful, I used Python 3.11 for the virtual environment.

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