{"id":24360,"library":"pymcubes","title":"PyMCubes","description":"A Python library for extracting isosurfaces from volumetric data using the marching cubes algorithm. Version 0.1.6 is the latest, with irregular releases.","status":"active","version":"0.1.6","language":"python","source_language":"en","source_url":"https://github.com/pmneila/PyMCubes","tags":["marching cubes","isosurface","3D","mesh","volume rendering"],"install":[{"cmd":"pip install pymcubes","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"pymcubes is a different library; the marching_cubes function is in scikit-image.","wrong":"from mcubes import marching_cubes","symbol":"marching_cubes","correct":"from skimage.measure import marching_cubes"},{"note":"The actual export is from the 'mcubes' module, not 'pymcubes'.","wrong":"from pymcubes import marching_cubes_func","symbol":"marching_cubes_func","correct":"from mcubes import marching_cubes_func"}],"quickstart":{"code":"import numpy as np\nfrom mcubes import marching_cubes, export_obj\n\n# Create volumetric data: a sphere\nX, Y, Z = np.mgrid[-2:2:50j, -2:2:50j, -2:2:50j]\nvolume = np.sqrt(X**2 + Y**2 + Z**2) - 1.0\n\n# Extract isosurface at level 0\nvertices, triangles = marching_cubes(volume, 0)\n\n# Export to OBJ file\nexport_obj(vertices, triangles, 'sphere.obj')\nprint('Isosurface extracted and saved to sphere.obj')","lang":"python","description":"Extract an isosurface from volumetric data and save as OBJ."},"warnings":[{"fix":"Use 'import mcubes' or 'from mcubes import ...' after pip install pymcubes.","message":"The correct import is 'from mcubes import ...' not 'from pymcubes import ...'. The package installs as pymcubes but the module is mcubes.","severity":"gotcha","affected_versions":"all"},{"fix":"Check the shape: vertices.shape should be (N,3).","message":"Marching cubes output vertices in a (N,3) array, not (3,N). Ensure your downstream code expects the correct shape.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install pymcubes' and then import using 'import mcubes'.","cause":"The Python module is 'mcubes', but users try to import 'pymcubes'.","error":"ModuleNotFoundError: No module named 'mcubes'"},{"fix":"Use 'from mcubes import marching_cubes' (singular).","cause":"The function is named 'marching_cubes' (singular), but users often try 'marching_cubes' (plural). Check spelling.","error":"ImportError: cannot import name 'marching_cubes' from 'mcubes'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}