Skip to content
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

import pymeshlab crashes on Windows 11 on 2023.12.post2 #398

Open
SharkWipf opened this issue Oct 11, 2024 · 4 comments
Open

import pymeshlab crashes on Windows 11 on 2023.12.post2 #398

SharkWipf opened this issue Oct 11, 2024 · 4 comments

Comments

@SharkWipf
Copy link

On Nerfstudio, there have been several recent reports (nerfstudio-project/nerfstudio#3461, more on discord) by Windows users of their ns-export commands closing without error.
Analyzing the dump in visual studio produces the following:
image
We have narrowed the issue down to this line specifically, aka import pymeshlab.

Downgrading to pymeshlab==2023.12.post1 resolves the issue, so the issue seems to be specific to pymeshlab==2023.12.post2.
Confirmed on, at least, Python 3.8.20 and Numpy 1.24.4, on Windows 11.

In theory, simply running an import pymeshlab on Windows 11 should be enough to reproduce this issue.

(I have not personally reproduced this yet as I don't have access to a Windows machine I could test this on right now, though I've helped narrow it down. At least 5 people reported this issue over the past few days however.)

@zalo
Copy link

zalo commented Nov 13, 2024

I can confirm this issue is still present in the latest pip install pymeshlab.

@alemuntoni
Copy link
Member

Is this happening only on python 3.8? We already dropped it, since it reached its end of life.

@SharkWipf
Copy link
Author

Is this happening only on python 3.8? We already dropped it, since it reached its end of life.

I've asked someone on Windows to test this, they've tested Python 3.8, 3.9 and 3.10. The problem only happened on Python 3.8, so that seems to be it.
I didn't realize Python 3.8 was EOL already, it's still the default recommended Python version for Nerfstudio. Guess it's time to update that then.

Do you want to keep the issue open regardless, or should it be closed?

So tl;dr for anyone coming across this in the future: Update your Python to not-3.8.

@zalo
Copy link

zalo commented Nov 18, 2024

Ah, sorry, my error is similar, but slightly different in Python 3.11.4.

Importing works fine, but pymeshlab==2023.12.post2 is crashing trying to execute uv_mapped_mesh = pymeshlab.Mesh(vertex_matrix=vertices, face_matrix=indices, v_tex_coords_matrix=uvs.astype(np.float64)).

Downgrading to pymeshlab==2023.12.post1 fixes it here.

Have we tracked down what happened between post1 and post2 that made Windows machines unhappy?

Here's the full reproduction script:

print("Importing Libraries...")
import numpy as np
print("Imported Numpy!  Loading xatlas...")
import xatlas
print("Imported xatlas!  Loading pymeshlab...")
import pymeshlab

mesh_to_simplify_name = 'myMesh.stl'

print("Imported all Libraries!  Loading mesh...")

#pymeshlab.print_filter_list()
ms = pymeshlab.MeshSet()
print("Load a new mesh, and set it as the current mesh...")
ms.load_new_mesh(mesh_to_simplify_name)
print("Loaded! Mesh ID:", ms.current_mesh_id(), "Simplifying...")
ms.apply_filter('meshing_decimation_quadric_edge_collapse', targetfacenum=60000)
ms.save_current_mesh('./simplified_mesh.stl')
print("Surface Simplification Completed!")

print("UV Unwrapping...")
vmapping, indices, uvs = xatlas.parametrize(ms.current_mesh().vertex_matrix(), ms.current_mesh().face_matrix())
print(vmapping, indices, uvs)
vertices = np.copy(ms.current_mesh().vertex_matrix()[vmapping])
ms = pymeshlab.MeshSet()
print("UV Unwrapping completed; constructing new pymeshlab mesh...")  # <--- CRASHES AFTER THIS PRINTS
uv_mapped_mesh = pymeshlab.Mesh(vertex_matrix=vertices, face_matrix=indices, v_tex_coords_matrix=uvs.astype(np.float64))
print("Adding mesh to current workspace...")
ms.add_mesh(uv_mapped_mesh, "UV Mesh")
print("UV Unwrapping Complete! New Mesh ID:", ms.current_mesh_id())
ms.save_current_mesh('./simplified_uv_mapped_mesh.obj')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants