{"id":45059,"library":"gtsam","title":"GTSAM (Georgia Tech Smoothing and Mapping)","description":"GTSAM is a C++ library for smoothing and mapping (SLAM and bundle adjustment) with Python bindings. Current version 4.2.1. Release cadence is irregular, roughly 1-2 major versions per year with minor patches as needed.","status":"active","version":"4.2.1","language":"python","source_language":"en","source_url":"https://github.com/borglab/gtsam","tags":["slam","factor-graph","nonlinear-optimization","bundle-adjustment"],"install":[{"cmd":"pip install gtsam","lang":"bash","label":"Default install from PyPI"}],"dependencies":[{"reason":"Core dependency for numerical operations and array handling","package":"numpy","optional":false},{"reason":"Required for GTSAM's plotting utilities","package":"matplotlib","optional":true}],"imports":[{"note":"Wildcard import is discouraged; namespace may have conflicts.","wrong":"from gtsam import *","symbol":"gtsam","correct":"import gtsam"},{"note":"Wrong: plotting module is a subpackage; correct import ensures plot functions are available.","wrong":"import gtsam.utils.plot as plot","symbol":"gtsam.utils.plot","correct":"from gtsam.utils import plot"}],"quickstart":{"code":"import gtsam\nimport numpy as np\n\n# Create a factor graph and initial estimates\ngraph = gtsam.NonlinearFactorGraph()\ninitial = gtsam.Values()\n\n# Pose prior at origin\nprior_noise = gtsam.noiseModel.Diagonal.Sigmas(np.array([0.3, 0.3, 0.1]))\ngraph.add(gtsam.PriorFactorPose2(1, gtsam.Pose2(0, 0, 0), prior_noise))\ninitial.insert(1, gtsam.Pose2(0.2, -0.3, 0.2))\n\n# Odometry measurement\nodo_noise = gtsam.noiseModel.Diagonal.Sigmas(np.array([0.2, 0.2, 0.1]))\ngraph.add(gtsam.BetweenFactorPose2(1, 2, gtsam.Pose2(2, 0, 0), odo_noise))\ninitial.insert(2, gtsam.Pose2(2.1, 0.1, -0.1))\n\n# Optimize\noptimizer = gtsam.LevenbergMarquardtOptimizer(graph, initial)\nresult = optimizer.optimize()\n\nprint(result)\n","lang":"python","description":"Simple 2D pose graph SLAM with a single odometry constraint."},"warnings":[{"fix":"Update code to use new API; see migration guide at https://gtsam.org/docs/4.2/migration.html","message":"In GTSAM 4.2.0+, the `DiscreteDistribution` API changed: `DiscreteDistribution` constructor no longer takes a `spec` argument; use `DiscreteDistribution.BayesNet`.","severity":"breaking","affected_versions":">=4.2.0"},{"fix":"Use `gtsam` directly, e.g., `gtsam.NonlinearFactorGraph`.","message":"Using `opengtsam` prefix (e.g., `opengtsam.NonlinearFactorGraph`) is legacy and may be removed in future versions.","severity":"gotcha","affected_versions":">=4.2.0"},{"fix":"pip install --no-cache-dir --force-reinstall gtsam","message":"Some Python `__init__.py` files may be missing in older installations, causing `ImportError: No module named gtsam.unstable`. Reinstall with `--no-cache-dir` if this occurs.","severity":"gotcha","affected_versions":"<=4.1"},{"fix":"Construct `ISAM2` using `gtsam.ISAM2(gtsam.ISAM2Params())`.","message":"`gtsam.ISAM2` is deprecated; use `gtsam.ISAM2Params` and `gtsam.ISAM2` with explicit parameters.","severity":"deprecated","affected_versions":">=4.2.0"}],"env_vars":null,"search_vec":"'-2':32 '1':31 '4.2.1':25 'adjust':19,51 'bind':22 'bundl':18,50 'bundle-adjust':49 'c':10 'cadenc':27 'current':23 'factor':44 'factor-graph':43 'georgia':2 'graph':45 'gtsam':1,7 'irregular':29 'librari':11 'major':33 'map':6,15 'minor':38 'need':41 'nonlinear':47 'nonlinear-optim':46 'optim':48 'patch':39 'per':35 'python':21 'releas':26 'rough':30 'slam':16,42 'smooth':4,13 'tech':3 'version':24,34 'year':36","created_at":"2026-06-07T12:53:10.143380+00:00","updated_at":"2026-06-07T12:53:10.143380+00:00","problems":[{"fix":"Rename or remove the local file 'gtsam.py'.","cause":"Conflicting local file named 'gtsam.py' in working directory shadowing the installed package.","error":"ImportError: cannot import name 'gtsam' from 'gtsam'"},{"fix":"pip install gtsam[docs]","cause":"Optional docstring extra not installed.","error":"RuntimeError: The docstring of gtsam.Pose2 is not available. Install with 'pip install gtsam[docs]' or use -numpy."},{"fix":"pip install matplotlib","cause":"Matplotlib is not installed but required by `gtsam.utils.plot`.","error":"Failed to import `gtsam.utils` due to missing `matplotlib`."},{"fix":"Check the API documentation for version 4.2 and adjust code accordingly.","cause":"API change between GTSAM 4.1 and 4.2 for certain factor constructors or noise models.","error":"TypeError: __init__() got an unexpected keyword argument 'some_param'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://gtsam.org/","github":null,"docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}