-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MacOS Error for name 'trimesh' is not defined; Failed to import pyrender. Rendering will not work. #32
Comments
Did (py3.11) ➜ rendering git:(main) pip install luisa-python
Collecting luisa-python
Downloading luisa_python-0.3.7-cp311-cp311-macosx_14_0_arm64.whl.metadata (33 kB)
Collecting sourceinspect (from luisa-python)
Downloading sourceinspect-0.0.4-py3-none-any.whl.metadata (1.1 kB)
Requirement already satisfied: numpy in /opt/homebrew/Caskroom/miniconda/base/envs/py3.11/lib/python3.11/site-packages (from luisa-python) (1.26.4)
Requirement already satisfied: dill in /opt/homebrew/Caskroom/miniconda/base/envs/py3.11/lib/python3.11/site-packages (from sourceinspect->luisa-python) (0.3.8)
Downloading luisa_python-0.3.7-cp311-cp311-macosx_14_0_arm64.whl (23.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23.9/23.9 MB 7.0 MB/s eta 0:00:00
Downloading sourceinspect-0.0.4-py3-none-any.whl (3.5 kB)
Installing collected packages: sourceinspect, luisa-python
Successfully installed luisa-python-0.3.7 sourceinspect-0.0.4
(py3.11) ➜ rendering git:(main) python demo.py
objc[53611]: Class GLFWHelper is implemented in both /opt/homebrew/Caskroom/miniconda/base/envs/py3.11/lib/python3.11/site-packages/taichi/_lib/core/taichi_python.cpython-311-darwin.so (0x329e00570) and /opt/homebrew/Caskroom/miniconda/base/envs/py3.11/lib/python3.11/site-packages/pygel3d/libPyGEL.dylib (0x377a517c0). One of the two will be used. Which one is undefined.
objc[53611]: Class GLFWApplicationDelegate is implemented in both /opt/homebrew/Caskroom/miniconda/base/envs/py3.11/lib/python3.11/site-packages/taichi/_lib/core/taichi_python.cpython-311-darwin.so (0x329e005c0) and /opt/homebrew/Caskroom/miniconda/base/envs/py3.11/lib/python3.11/site-packages/pygel3d/libPyGEL.dylib (0x377a51810). One of the two will be used. Which one is undefined.
objc[53611]: Class GLFWWindowDelegate is implemented in both /opt/homebrew/Caskroom/miniconda/base/envs/py3.11/lib/python3.11/site-packages/taichi/_lib/core/taichi_python.cpython-311-darwin.so (0x329e005e8) and /opt/homebrew/Caskroom/miniconda/base/envs/py3.11/lib/python3.11/site-packages/pygel3d/libPyGEL.dylib (0x377a51838). One of the two will be used. Which one is undefined.
objc[53611]: Class GLFWContentView is implemented in both /opt/homebrew/Caskroom/miniconda/base/envs/py3.11/lib/python3.11/site-packages/taichi/_lib/core/taichi_python.cpython-311-darwin.so (0x329e00638) and /opt/homebrew/Caskroom/miniconda/base/envs/py3.11/lib/python3.11/site-packages/pygel3d/libPyGEL.dylib (0x377a51888). One of the two will be used. Which one is undefined.
objc[53611]: Class GLFWWindow is implemented in both /opt/homebrew/Caskroom/miniconda/base/envs/py3.11/lib/python3.11/site-packages/taichi/_lib/core/taichi_python.cpython-311-darwin.so (0x329e006b0) and /opt/homebrew/Caskroom/miniconda/base/envs/py3.11/lib/python3.11/site-packages/pygel3d/libPyGEL.dylib (0x377a51900). One of the two will be used. Which one is undefined.
[Genesis] [09:35:43] [INFO] ╭─────────────────────────────────────────────────────────────────────────────────────╮
[Genesis] [09:35:43] [INFO] │┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉ Genesis ┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉│
[Genesis] [09:35:43] [INFO] ╰─────────────────────────────────────────────────────────────────────────────────────╯
[Genesis] [09:35:43] [INFO] Running on [Apple M3 Max] with backend gs.metal. Device memory: 128.00 GB.
[Genesis] [09:35:43] [DEBUG] [Taichi] version 1.7.2, llvm 15.0.7, commit 0131dce9, osx, python 3.11.8
[Genesis] [09:35:43] [DEBUG] [Taichi] Starting on arch=metal
[Genesis] [09:35:43] [INFO] 🚀 Genesis initialized. 🔖 version: 0.2.0, 🌱 seed: 0, 📏 precision: '32', 🐛 debug: False, 🎨 theme: 'dark'.
Traceback (most recent call last):
File "/opt/homebrew/Caskroom/miniconda/base/envs/py3.11/lib/python3.11/site-packages/genesis/vis/raytracer.py", line 17, in <module>
import LuisaRenderPy
ModuleNotFoundError: No module named 'LuisaRenderPy'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/dome/work/general/Genesis/examples/rendering/demo.py", line 166, in <module>
main()
File "/Users/dome/work/general/Genesis/examples/rendering/demo.py", line 11, in main
scene = gs.Scene(
^^^^^^^^^
File "/opt/homebrew/Caskroom/miniconda/base/envs/py3.11/lib/python3.11/site-packages/genesis/utils/misc.py", line 27, in new_init
original_init(self, *args, **kwargs)
File "/opt/homebrew/Caskroom/miniconda/base/envs/py3.11/lib/python3.11/site-packages/genesis/engine/scene.py", line 148, in __init__
self._visualizer = Visualizer(
^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniconda/base/envs/py3.11/lib/python3.11/site-packages/genesis/vis/visualizer.py", line 60, in __init__
from .raytracer import Raytracer
File "/opt/homebrew/Caskroom/miniconda/base/envs/py3.11/lib/python3.11/site-packages/genesis/vis/raytracer.py", line 19, in <module>
gs.raise_exception(f"Failed to import LuisaRenderer. {e.__class__.__name__}: {e}")
[Genesis] [09:35:45] [ERROR] Failed to import LuisaRenderer. ModuleNotFoundError: No module named 'LuisaRenderPy'
[Genesis] [09:35:45] [INFO] 💤 Exiting Genesis and caching compiled kernels... |
I am sorry that Luisa requires cuda, and it is only supported on ubuntu now. you can use rasterization on macOS. Here is an example: https://github.com/Genesis-Embodied-AI/Genesis/blob/main/examples/render_on_macos.py |
The readme states that it supports metal too: https://github.com/LuisaGroup/LuisaCompute?tab=readme-ov-file#backends-context-devices-and-resources
Update: wrong repo, this is the renderer I guess https://github.com/LuisaGroup/LuisaRender, but even here they state:
render_on_macos.py works for me. However, other examples are buggy on my system, like if I modify the elastic dragon example, the viewer initially doesn't open (but only after a few secs) and at some point it becomes responsive. Still, I can see the dragon moving: import argparse
import numpy as np
import genesis as gs
from time import time
import threading
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--vis", action="store_true", default=False)
parser.add_argument("-c", "--cpu", action="store_true", default=False)
args = parser.parse_args()
########################## init ##########################
gs.init(backend=gs.cpu if args.cpu else gs.gpu, logging_level="debug")
########################## create a scene ##########################
scene = gs.Scene(
sim_options=gs.options.SimOptions(
substeps=10,
gravity=(0, 0, -9.8),
),
viewer_options=gs.options.ViewerOptions(
camera_pos=(2, 2, 1.5),
camera_lookat=(0, 0, 0.5),
camera_up=(0, 0, 1),
camera_fov=40,
),
show_viewer=args.vis,
)
########################## materials ##########################
mat_elastic = gs.materials.PBD.Elastic()
########################## entities ##########################
bunny = scene.add_entity(
material=mat_elastic,
morph=gs.morphs.Mesh(
file="meshes/dragon/dragon.obj",
scale=0.003,
pos=(0, 0, 0.8),
),
surface=gs.surfaces.Default(
# vis_mode='recon',
),
)
########################## build ##########################
scene.build()
gs.tools.run_in_another_thread(fn=run_sim, args=(scene, args.vis))
if args.vis:
scene.viewer.start()
def run_sim(scene, enable_vis):
horizon = 1000
t_prev = time()
# forward pass
for i in range(horizon):
scene.step()
t_now = time()
print(1 / (t_now - t_prev), "FPS")
t_prev = t_now
# if enable_vis:
# scene.viewer.stop()
if __name__ == "__main__":
main() |
hey @zhenjia-xu , thank you for providing the Mac example! I managed to run it on my Mac M2 (MacOS 15.1.1 (24B91)) without visualization:
However, when I tried to visualize (-v) then it raises more errors like
and then hangs on:
I've installed ffmpg (brew) and pyopenGL (poetry), here's my pyproject.toml
any hints how to solve this? |
Same Error occured when I run the sample code. The error traceback indicates that the issue is still related to trimesh not being defined. Specifically, the error occurs within the genesis library when it tries to initialize the Visualizer and calls trimesh.creation.axis, but trimesh is not defined. 、、、 |
@VioletBenin I'm having same error if someone find solution please let me know. Thank you |
The solution is set an older venison of PyGEL3D like 0.1.0. The most updated one made conflict with Taichi 1.7.2. |
Same thing happens for me. Runs without visualisation, but hangs when I try running with |
SOLUTION:
import os |
(genesis) baihaotian@Bais-MacBook-Pro-2 space_time_inpaint % python test.py
objc[73181]: Class GLFWHelper is implemented in both /opt/anaconda3/envs/genesis/lib/python3.11/site-packages/taichi/_lib/core/taichi_python.cpython-311-darwin.so (0x1733f4570) and /opt/anaconda3/envs/genesis/lib/python3.11/site-packages/pygel3d/libPyGEL.dylib (0x317cd97c0). One of the two will be used. Which one is undefined.
objc[73181]: Class GLFWApplicationDelegate is implemented in both /opt/anaconda3/envs/genesis/lib/python3.11/site-packages/taichi/_lib/core/taichi_python.cpython-311-darwin.so (0x1733f45c0) and /opt/anaconda3/envs/genesis/lib/python3.11/site-packages/pygel3d/libPyGEL.dylib (0x317cd9810). One of the two will be used. Which one is undefined.
objc[73181]: Class GLFWWindowDelegate is implemented in both /opt/anaconda3/envs/genesis/lib/python3.11/site-packages/taichi/_lib/core/taichi_python.cpython-311-darwin.so (0x1733f45e8) and /opt/anaconda3/envs/genesis/lib/python3.11/site-packages/pygel3d/libPyGEL.dylib (0x317cd9838). One of the two will be used. Which one is undefined.
objc[73181]: Class GLFWContentView is implemented in both /opt/anaconda3/envs/genesis/lib/python3.11/site-packages/taichi/_lib/core/taichi_python.cpython-311-darwin.so (0x1733f4638) and /opt/anaconda3/envs/genesis/lib/python3.11/site-packages/pygel3d/libPyGEL.dylib (0x317cd9888). One of the two will be used. Which one is undefined.
objc[73181]: Class GLFWWindow is implemented in both /opt/anaconda3/envs/genesis/lib/python3.11/site-packages/taichi/_lib/core/taichi_python.cpython-311-darwin.so (0x1733f46b0) and /opt/anaconda3/envs/genesis/lib/python3.11/site-packages/pygel3d/libPyGEL.dylib (0x317cd9900). One of the two will be used. Which one is undefined.
Failed to import pyrender. Rendering will not work.
[Genesis] [15:57:22] [INFO] ╭─────────────────────────────────────────────────────────────────────────────────────╮
[Genesis] [15:57:22] [INFO] │┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉ Genesis ┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉│
[Genesis] [15:57:22] [INFO] ╰─────────────────────────────────────────────────────────────────────────────────────╯
[Genesis] [15:57:22] [INFO] Running on [Apple M1 Pro] with backend gs.cpu. Device memory: 16.00 GB.
[Genesis] [15:57:22] [INFO] 🚀 Genesis initialized. 🔖 version: 0.2.0, 🌱 seed: None, 📏 precision: '32', 🐛 debug: False, 🎨 theme: 'dark'.
Traceback (most recent call last):
File "/Users/baihaotian/code/space_time_inpaint/test.py", line 4, in
scene = gs.Scene(show_viewer=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/genesis/lib/python3.11/site-packages/genesis/utils/misc.py", line 27, in new_init
original_init(self, *args, **kwargs)
File "/opt/anaconda3/envs/genesis/lib/python3.11/site-packages/genesis/engine/scene.py", line 148, in init
self._visualizer = Visualizer(
^^^^^^^^^^^
File "/opt/anaconda3/envs/genesis/lib/python3.11/site-packages/genesis/vis/visualizer.py", line 26, in init
self._context = RasterizerContext(vis_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/genesis/lib/python3.11/site-packages/genesis/vis/rasterizer_context.py", line 37, in init
self.init_meshes()
File "/opt/anaconda3/envs/genesis/lib/python3.11/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
The text was updated successfully, but these errors were encountered: