question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ModuleNotFoundError: No module named 'triangle'

See original GitHub issue

Hello, today I installed trimesh on a Windows x64 using: conda install -c conda-forge trimesh With: trimesh.__version__ I get: 3.6.20.

I wanted to extrude a shapely polygon using the following: import trimesh my_mesh = trimesh.creation.extrude_polygon(my_poly, 12, transform=None, triangle_args=None) This results in the following error: ModuleNotFoundError: No module named 'triangle'

I thought that with using conda all dependencies would be installed.

The exact location where the error is occuring is:

  File "C:\Anaconda3\envs\my_env\lib\site-packages\trimesh\creation.py", line 187, in extrude_polygon
    polygon, triangle_args=triangle_args, **kwargs)

  File "C:\Anaconda3\envs\my_env\lib\site-packages\trimesh\creation.py", line 435, in triangulate_polygon
    from triangle import triangulate

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
mikedhcommented, Jul 24, 2020

Hey, looks like you’re missing the soft dependency triangle, try running: pip install triangle

On Fri, Jul 24, 2020 at 9:33 AM Fernando Gomes notifications@github.com wrote:

Hello for all,

Same issue persists here:

import trimesh p = trimesh.path.polygons.random_polygon() trimesh.creation.extrude_polygon(p, 50)

Results in …

ModuleNotFoundError Traceback (most recent call last) <ipython-input-41-bc92864e8bb6> in <module> 1 p = trimesh.path.polygons.random_polygon() ----> 2 trimesh.creation.extrude_polygon(p, 50)

~/miniconda3/envs/pcp-env/lib/python3.7/site-packages/trimesh/creation.py in extrude_polygon(polygon, height, transform, triangle_args, **kwargs) 187 # create a triangulation from the polygon 188 vertices, faces = triangulate_polygon( –> 189 polygon, triangle_args=triangle_args, **kwargs) 190 # extrude that triangulation along Z 191 mesh = extrude_triangulation(vertices=vertices,

~/miniconda3/envs/pcp-env/lib/python3.7/site-packages/trimesh/creation.py in triangulate_polygon(polygon, triangle_args, engine, **kwargs) 455 456 # do the import here for soft requirement –> 457 from triangle import triangulate 458 # set default triangulation arguments if not specified 459 if triangle_args is None:

ModuleNotFoundError: No module named ‘triangle’

I am gonna try manual installation and tell here later

Thanks,

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/mikedh/trimesh/issues/770#issuecomment-663540787, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKWRQTTEL5SARUFN3N4L3LR5GETPANCNFSM4L7HSE7A .

1reaction
mikedhcommented, Oct 5, 2022

Hey, yeah I don’t know how conda handles it, I tested with pip in a venv which also works pretty well. triangle is on conda-forge which may be in your env but if not you would need to install it with conda install -c conda-forge triangle

Though triangle unfortunately was removed from requires for license issues in this pr. The logic if you call trimesh.creation.triangulate_polygon(..., engine='triangle') is still there because it requires opt-in and independently installing triangle.

Defaults were switched to mapbox-earcut: https://pypi.org/project/mapbox-earcut/ which you can get through pip (pip install mapbox-earcut) or conda ( conda install -c conda-forge mapbox_earcut).

Read more comments on GitHub >

github_iconTop Results From Across the Web

No module named triangle · Issue #298 - GitHub
from pylayers.simul.link import * after show me this message "No module named triangle" I installed the triangle through the "conda install ...
Read more >
How to fix "ModuleNotFoundError: No module named 'triangle'"
You must first install the package before you can use it in your code. Run the following command to install the package and...
Read more >
ModuleNotFoundError: No module named 'triangle.py'
Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'triangle.py' How to remove the Module.
Read more >
triangle - PyPI
Python binding to the triangle library.
Read more >
No module named 'meshpy._triangle' - python - Stack Overflow
Likely you have created file named meshpy within your python package, which leads to the module shadowing, renaming your file shall fix the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found