Genesis icon indicating copy to clipboard operation
Genesis copied to clipboard

Trimesh Error Report

Open CosmosMount opened this issue 11 months ago • 3 comments
trafficstars

Traceback (most recent call last):
  File "/home/yzhang/桌面/VSCode_Py/genesis/test_1.py", line 3, in <module>
    scene = gs.Scene(
            ^^^^^^^^^
  File "/home/yzhang/.local/lib/python3.12/site-packages/genesis/utils/misc.py", line 27, in new_init
    original_init(self, *args, **kwargs)
  File "/home/yzhang/.local/lib/python3.12/site-packages/genesis/engine/scene.py", line 148, in __init__
    self._visualizer = Visualizer(
                       ^^^^^^^^^^^
  File "/home/yzhang/.local/lib/python3.12/site-packages/genesis/vis/visualizer.py", line 26, in __init__
    self._context = RasterizerContext(vis_options)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/yzhang/.local/lib/python3.12/site-packages/genesis/vis/rasterizer_context.py", line 37, in __init__
    self.init_meshes()
  File "/home/yzhang/.local/lib/python3.12/site-packages/genesis/vis/rasterizer_context.py", line 52, in init_meshes
    self.link_frame_mesh = trimesh.creation.axis(origin_size=0.03, axis_radius=0.025, axis_length=1.0)
                           ^^^^^^^
NameError: name 'trimesh' is not defined

I came across this message many times and tried pip install trimesh then put import trimesh in rasterizer_context.py but it didn't work. I was quite upset.

CosmosMount avatar Dec 20 '24 12:12 CosmosMount

I had the same issue on my Mac M3 and it was related to this issue: #26

analogjedi avatar Dec 20 '24 14:12 analogjedi

Genesis doesn't use trimesh from pip install, but from genesis/ext/trimesh. See here. You can check by

from genesis.ext import pyrender, trimesh
from genesis.ext.pyrender.jit_render import JITRenderer

to figure out why it is not imported.

DuinoDu avatar Dec 20 '24 18:12 DuinoDu

Genesis doesn't use trimesh from pip install, but from genesis/ext/trimesh. See here. You can check by

from genesis.ext import pyrender, trimesh
from genesis.ext.pyrender.jit_render import JITRenderer

to figure out why it is not imported.

I had the same issue on my Mac M3 and it was related to this issue: #26

Thanks so much for your replies. The problem was solved when I perform the following steps referring to #26.

  1. Pip install trimesh and pyrender
  2. Turning the origin try-except to
try:
     from genesis.ext import pyrender, trimesh
     from genesis.ext.pyrender.jit_render import JITRenderer
except:
    import trimesh
    import pyrender

Then the error message turned into OpenGL error. To solve it, I use pip install -U PyOpenGL to upgrade it to the latest version and solve the problem. Also, reinstall genesis-world may also work.

CosmosMount avatar Dec 21 '24 05:12 CosmosMount

@Yzhang367 Python needs to be built with Tk. I've provided some instructions here

neil-tan avatar Feb 11 '25 05:02 neil-tan