{"id":2446,"library":"conan","title":"Conan C/C++ Package Manager","description":"Conan is an open-source C/C++ package manager that facilitates dependency management and binary distribution for C and C++ projects. It offers significant flexibility for integrating with various build systems, compilers, and configurations across different platforms. The current version is 2.27.0, and it maintains an active development cycle with frequent releases, typically on a monthly or bi-monthly cadence.","status":"active","version":"2.27.0","language":"en","source_language":"en","source_url":"https://github.com/conan-io/conan","tags":["package manager","c++","c","build system","dependency management"],"install":[{"cmd":"pip install conan","lang":"bash","label":"Install Conan"}],"dependencies":[],"imports":[{"note":"The Python API for Conan was completely rewritten for Conan 2.x, changing import paths and class structures from the Conan 1.x API.","wrong":"from conans.client.api import Conan","symbol":"ConanAPI","correct":"from conan.api.conan_api import ConanAPI"}],"quickstart":{"code":"from conan.api.conan_api import ConanAPI\n\n# Initialize the Conan API. For advanced use, cache_folder can be specified.\nconan_api = ConanAPI()\n\nprint(\"Conan API initialized.\")\n\n# Example: List installed recipes in the local cache\n# The 'list' sub-API provides methods for inspecting packages and recipes.\nlocal_recipes = conan_api.list.recipes(query=\"*\")\n\nif local_recipes:\n    print(f\"Found {len(local_recipes)} local recipes:\")\n    for ref in local_recipes:\n        print(f\"  - {ref}\")\nelse:\n    print(\"No recipes found in the local Conan cache.\")\n\n# Example: Get Conan's current home folder\nconan_home = conan_api.home_folder\nprint(f\"Conan home folder: {conan_home}\")","lang":"python","description":"This quickstart initializes the Conan API and demonstrates how to programmatically interact with Conan, specifically by listing recipes in the local cache and retrieving the Conan home directory. The `ConanAPI` object provides access to various sub-APIs for different functionalities."},"warnings":[{"fix":"Consult the official Conan 2.0 Migration Guide (e.g., in the Conan documentation) to understand the necessary updates for recipes, commands, and project integrations. Existing Conan 1.x binary packages cannot be reused directly with Conan 2.x.","message":"Conan 2.0 introduced major breaking changes compared to Conan 1.x. The Python API, recipe format (`conanfile.py`), command-line interface, and binary package formats are incompatible. Recipes and existing builds from Conan 1.x projects *must* be migrated.","severity":"breaking","affected_versions":"2.0.0 and later (when upgrading from 1.x)"},{"fix":"Monitor Conan release notes for Python API changes. For stable long-term automation, consider wrapping the `conan` CLI commands via `subprocess` or limit Python API usage to documented and stable parts.","message":"The Conan Python API (`conan.api.conan_api.ConanAPI`) is currently experimental and explicitly stated to be subject to breaking changes across minor versions. Relying heavily on it for critical automation may require frequent updates.","severity":"gotcha","affected_versions":"2.0.0 and later (all 2.x versions)"},{"fix":"Ensure you are running Conan 2.26.2 or newer, especially on Windows, to benefit from fixes addressing issues with antivirus interference during package downloads.","message":"Older Conan 2.x versions (specifically 2.25.0 to 2.25.2, and some 2.26.x before 2.26.2) had issues with atomic file operations during package binary downloads on Windows, often clashing with antivirus software, leading to failures or corrupted caches.","severity":"gotcha","affected_versions":"2.25.0 - 2.25.2, 2.26.0 - 2.26.1"},{"fix":"In Conan 2.x, it is recommended to explicitly define and manage profiles rather than relying on `conan profile detect` for critical build configurations. Manually review and update profiles after migration.","message":"The behavior of `conan profile detect` changed significantly from Conan 1.x to 2.x. Relying on its output as a stable baseline, especially for build automation, can lead to unexpected results in Conan 2.x.","severity":"gotcha","affected_versions":"2.0.0 and later (when migrating from 1.x)"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}