error using trimesh library on python - " no graph engine available "

1.7k views Asked by At

I was wondering if you have used the library "trimesh" in python. It looks quite useful, but right now im having some trouble with the method "Trimesh.spli()" on the last line of the code attached. the code was working fine up to that line, which is suppose to return a list of trimesh objects.

However, when I try to run this code, I get the error ImportError: no graph engines available! Do you know how can I set up a graph engine? or if there is any turnaround this issue? Thanks for your support, Regards

import numpy as np
import trimesh

# Load the stl files into the script
mesh = trimesh.load('Path_to_STL_file')
mesh2 = trimesh.load('Path_to_raw_material_in_STL')

# Confirm both files are closed
assert mesh.is_watertight
assert mesh2.is_watertight

#Boolean operation
mesh3 = trimesh.Trimesh.difference(mesh2,mesh)
list_mesh = trimesh.Trimesh.split(mesh3)
2

There are 2 answers

0
EmanuelMtzV On BEST ANSWER

I found the issue. The library does not install all dependancies unless you ask for it. Usually, it only requires numpy.

One option to install most of the dependancies is:

pip install trimesh[easy]

or, if that doesn't solve it, you could use:

pip install trimesh[all]
0
adamconkey On

You need to also install either scipy or networkx to satisfy the graph engine dependency. There's a comment in the source code that networkx is 5-10 times slower than scipy so it's probably best to install scipy. If you're using pip then it's

pip install scipy

or if you're using conda:

conda install scipy