Reverb commited on
Commit
5693ff7
·
1 Parent(s): 313ffe0

Fix: evict pip-installed trellis2 stub from sys.modules before loading vendored copy

Browse files

o_voxel's wheel METADATA lists trellis2 as a dependency, so pip installs a
PyPI trellis2 package that ends up in sys.modules with the wrong __path__.
importlib.import_module('.models', 'trellis2') then fails with ModuleNotFoundError
because it searches the PyPI package path, not our TRELLIS.2/trellis2/.

Fix: clear all trellis2/* entries from sys.modules after sys.path.insert so
the subsequent 'import trellis2' loads from our vendored directory.

Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -39,7 +39,12 @@ os.environ["FLEX_GEMM_AUTOTUNE_CACHE_PATH"] = str(_TRELLIS_DIR / "autotune_cache
39
  os.environ.setdefault("FLEX_GEMM_AUTOTUNER_VERBOSE", "0")
40
  if str(_TRELLIS_DIR) not in sys.path:
41
  sys.path.insert(0, str(_TRELLIS_DIR))
42
- import trellis2 # noqa: E402, F401 — fully initialise before any src.stages import
 
 
 
 
 
43
 
44
  import gradio as gr
45
  import spaces # HF ZeroGPU
 
39
  os.environ.setdefault("FLEX_GEMM_AUTOTUNER_VERBOSE", "0")
40
  if str(_TRELLIS_DIR) not in sys.path:
41
  sys.path.insert(0, str(_TRELLIS_DIR))
42
+ # o_voxel/flex_gemm wheels list 'trellis2' as a pip dependency, so pip
43
+ # installs a PyPI trellis2 stub that lands in sys.modules with the wrong
44
+ # __path__. Evict it so our vendored copy is loaded instead.
45
+ for _k in [k for k in sys.modules if k == "trellis2" or k.startswith("trellis2.")]:
46
+ del sys.modules[_k]
47
+ import trellis2 # noqa: E402, F401 — loads our TRELLIS.2/trellis2/ copy
48
 
49
  import gradio as gr
50
  import spaces # HF ZeroGPU