{"id":7587,"library":"pymeshlab","title":"PyMeshLab","description":"PyMeshLab is a Python interface to MeshLab, providing a robust toolset for 3D mesh processing, filtering, and analysis. It allows users to programmatically access MeshLab's powerful algorithms without needing the GUI. The current version is 2025.7.post1, with releases typically occurring yearly, often followed by several post-releases for bug fixes and updated Python/dependency support.","status":"active","version":"2025.7.post1","language":"en","source_language":"en","source_url":"https://github.com/cnr-isti-vclab/PyMeshLab","tags":["3D","mesh processing","computer graphics","MeshLab","point cloud"],"install":[{"cmd":"pip install pymeshlab","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required for mesh data manipulation and representation.","package":"numpy","optional":false}],"imports":[{"symbol":"MeshSet","correct":"import pymeshlab as ml\nms = ml.MeshSet()"}],"quickstart":{"code":"import pymeshlab as ml\nimport os\n\n# Create a MeshSet object\nms = ml.MeshSet()\n\n# Example: Load a mesh, apply decimation, and save it\n# In a real scenario, replace with your actual mesh file path.\n# For demonstration, we'll assume a 'teapot.ply' exists or skip loading.\n\n# Path to a dummy input/output file for demonstration\ninput_path = os.path.join(os.getcwd(), \"dummy_input.ply\")\noutput_path = os.path.join(os.getcwd(), \"dummy_output.ply\")\n\n# To make this runnable without an actual mesh file, we'll bypass actual file ops for new users\n# In a real use-case, you'd load an existing mesh:\n# ms.load_new_mesh(input_path)\n\n# For this quickstart, let's create a simple mesh programmatically if no file\n# This is not common for PyMeshLab, but makes the example runnable.\n# In a real scenario, you would have loaded an actual mesh file.\n# If you have a .ply file, uncomment the line below and point it to your file.\n# ms.load_new_mesh(\"/path/to/your/mesh.ply\")\n\n# --- If you don't have a mesh file, this part makes the example executable ---\n# Create a dummy mesh if no file is loaded (for quickstart execution only)\nif ms.number_meshes() == 0:\n    print(\"No mesh loaded, creating a dummy mesh for demonstration...\")\n    # This is a highly simplified dummy mesh creation, not typical PyMeshLab usage\n    # It's just to ensure the filter application doesn't fail immediately.\n    try:\n        ms.add_color_sphere(radius=1.0, quality=2)\n        print(\"Dummy sphere created.\")\n    except Exception as e:\n        print(f\"Could not create dummy sphere: {e}. PyMeshLab is best used with existing mesh files.\")\n        # If even dummy creation fails, then the library isn't working as expected\n        # For this quickstart, we assume it works.\n# --- End of dummy mesh creation ---\n\nif ms.number_meshes() > 0:\n    print(f\"Number of meshes before decimation: {ms.current_mesh().vertex_number()}\")\n    # Apply a decimation filter (e.g., reduce mesh complexity by 50%)\n    # The parameters are specific to MeshLab filters.\n    ms.meshing_decimation_quadric_edge_collapse(TargetPerc=0.5)\n    print(f\"Number of meshes after decimation: {ms.current_mesh().vertex_number()}\")\n\n    # Save the modified mesh\n    # In a real scenario, ensure the output path is valid and writable\n    # ms.save_current_mesh(output_path)\n    # print(f\"Decimated mesh saved to: {output_path}\")\nelse:\n    print(\"No mesh available to process. Please load a valid mesh file for actual use.\")\n\nprint(\"PyMeshLab quickstart complete.\")","lang":"python","description":"This quickstart demonstrates how to initialize PyMeshLab's MeshSet, (optionally create a dummy mesh for demonstrative purposes, or ideally load an existing mesh), apply a common processing filter like decimation, and print some statistics. For actual use, replace the dummy mesh creation with `ms.load_new_mesh('/path/to/your/mesh.ply')` and `ms.save_current_mesh('/path/to/save/decimated_mesh.ply')`."},"warnings":[{"fix":"Ensure your Linux environment has `glibc` version 2.31 or higher. Consider updating your OS or using a newer Docker environment if you encounter `RuntimeError: Your glibc version (X.YY) is too old.`","message":"Older Linux systems may encounter runtime errors due to glibc version requirements. PyMeshLab enforces installation only on systems with `glibc >= 2.31`.","severity":"breaking","affected_versions":"2022.2.post4 onwards"},{"fix":"Check the PyPI page or GitHub releases for specific Python version compatibility. For example, `v2025.7.post1` adds support for Python 3.14, while `v2023.12.post3` added support for Python 3.13. Ensure your Python environment matches the library's requirements.","message":"PyMeshLab releases often update their supported Python versions. Newer PyMeshLab versions may drop support for older Python versions, and vice versa.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If using an older PyMeshLab version, stick to NumPy < 2.0. If you need NumPy 2.0, ensure you are using PyMeshLab 2023.12.post2 or newer.","message":"Compatibility with NumPy 2.0 was explicitly added in version 2023.12.post2. Older versions of PyMeshLab might not work correctly or might produce warnings/errors with NumPy 2.0.","severity":"gotcha","affected_versions":"Prior to 2023.12.post2"},{"fix":"For extremely large meshes, consider downsampling or simplifying them before processing, or ensure you have ample RAM available. Monitor memory usage during operations.","message":"Processing very large meshes can be memory intensive and slow, potentially leading to out-of-memory errors or long processing times, as PyMeshLab leverages MeshLab's C++ backend.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `pip install pymeshlab` to install the library.","cause":"The pymeshlab package is not installed or not available in the current Python environment.","error":"ModuleNotFoundError: No module named 'pymeshlab'"},{"fix":"This issue typically occurs on older Linux distributions. Upgrade your operating system, use a newer Docker image, or build PyMeshLab from source if your environment cannot meet the glibc 2.31 requirement.","cause":"The system's GNU C Library (glibc) version is older than the minimum required by PyMeshLab's compiled components.","error":"RuntimeError: Your glibc version (X.YY) is too old. PyMeshLab needs at least glibc 2.31."},{"fix":"Double-check the filter name for typos (they are case-sensitive). Consult the PyMeshLab documentation or MeshLab's filter list for correct filter names and their required parameters. For example, use `ms.apply_filter('filter_name', param1=value1, ...)`.","cause":"The specified filter name is incorrect, or the parameters provided do not match the filter's signature in MeshLab's underlying library.","error":"ValueError: Filter 'meshing_decimation_quadric_edge_collapse' not found or invalid parameters."},{"fix":"Ensure your PyMeshLab version supports your NumPy version. If you are on NumPy 2.0, upgrade PyMeshLab to 2023.12.post2 or newer. If you are on an older PyMeshLab, consider downgrading NumPy to a compatible version (e.g., `pip install 'numpy<2.0'`).","cause":"This usually indicates an incompatibility between a compiled extension (like PyMeshLab's backend) and the installed NumPy version, often occurring during major NumPy version upgrades (e.g., to NumPy 2.0).","error":"numpy.core.multiarray failed to import"},{"fix":"Verify that the file path is correct and absolute, the file exists, and you have read permissions. Also, ensure the mesh file format is supported by MeshLab (e.g., .ply, .obj, .stl).","cause":"The specified mesh file path does not exist, is incorrect, or the file is corrupted/unreadable.","error":"Cannot load mesh from file: /path/to/non/existent/mesh.ply"}]}