{"id":389,"library":"cycler","title":"Cycler","description":"Cycler is a Python library for creating composable style cycles, allowing for flexible and reusable combinations of style properties. The current version is 0.12.1, released on a regular basis, with the latest release on March 28, 2026.","status":"active","version":"0.12.1","language":"python","source_language":"en","source_url":"https://github.com/matplotlib/cycler","tags":["cycler","matplotlib","style cycles","Python"],"install":[{"cmd":"pip install cycler","lang":"bash","label":"Install Cycler"}],"dependencies":[{"reason":"Cycler is a dependency of Matplotlib, a popular plotting library.","package":"matplotlib"}],"imports":[{"note":"Importing the 'cycler' function from the 'cycler' module.","symbol":"cycler","correct":"from cycler import cycler"},{"note":"Importing the 'Cycler' class from the 'cycler' module.","symbol":"Cycler","correct":"from cycler import Cycler"}],"quickstart":{"code":"from cycler import cycler\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n# Generate sample data\nx = np.linspace(0, 2 * np.pi, 50)\noffsets = np.linspace(0, 2 * np.pi, 4, endpoint=False)\nyy = np.transpose([np.sin(x + phi) for phi in offsets])\n\n# Create a cycler object\nstyle_cycler = cycler(color=['r', 'g', 'b', 'c'], linestyle=['-', '--', '-.'])\n\n# Apply the cycler to the current axes\nplt.gca().set_prop_cycle(style_cycler)\n\n# Plot the data\nfor y in yy:\n    plt.plot(x, y)\n\nplt.show()","lang":"python","description":"This example demonstrates how to use Cycler to create a custom style cycle for plotting multiple sine curves with different colors and line styles."},"warnings":[{"fix":"Update the constructor calls to match the new signature as per the latest documentation.","message":"Cycler 0.12.1 introduces changes to the 'Cycler' class constructor, which may affect existing code that relies on the previous constructor signature.","severity":"breaking","affected_versions":"0.12.1"},{"fix":"Import 'cycler' before importing 'matplotlib.pyplot' to ensure the custom style cycle is applied correctly.","message":"When using Cycler with Matplotlib, ensure that the 'cycler' module is imported before creating plots to avoid potential conflicts with Matplotlib's default style cycle.","severity":"gotcha","affected_versions":"All"},{"fix":"Install the 'matplotlib' package using pip: `pip install matplotlib`","message":"The 'matplotlib' module is not found, preventing the script from importing it. This typically means the package is not installed in the current Python environment.","severity":"breaking","affected_versions":"All"},{"fix":"Install the 'matplotlib' package using pip: `pip install matplotlib`. Ensure that your environment has all necessary dependencies installed before running the script.","message":"The 'matplotlib' module was not found, leading to a ModuleNotFoundError. This indicates that the 'matplotlib' package is not installed or not available in the current Python environment.","severity":"breaking","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-05-12T13:28:34.458Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Install the `cycler` library using pip: `pip install cycler`","cause":"The `cycler` package is not installed in the Python environment, or the environment where it's installed is not the one being used.","error":"ModuleNotFoundError: No module named 'cycler'"},{"fix":"Upgrade the `cycler` library to its latest version: `pip install --upgrade cycler`","cause":"This error typically occurs when an older version of the `cycler` library is used with a newer version of `matplotlib` that expects a method (`change_key`) which is not present in the older `cycler` version.","error":"AttributeError: 'Cycler' object has no attribute 'change_key'"},{"fix":"Add `from cycler import cycler` at the top of your Python script or relevant code block.","cause":"The `cycler` object or class was used in a context (e.g., `matplotlib.rcParams`) without being explicitly imported from the `cycler` module.","error":"NameError: name 'cycler' is not defined"},{"fix":"Ensure `cycler` is up-to-date: `pip install --upgrade cycler`. If the issue persists, try importing `cycler` as a module and accessing its attributes: `import cycler` then `cycler.Cycler()`.","cause":"This usually indicates a version mismatch where the `Cycler` class might not be directly exposed at the top level of the `cycler` package in older versions, or there's a conflict with other installed packages.","error":"ImportError: cannot import name 'Cycler' from 'cycler'"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":0,"quickstart_tag":"stale","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.6,"disk_size":"17.8M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.6,"disk_size":"18M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.02,"mem_mb":0.8,"disk_size":"19.7M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.02,"mem_mb":0.8,"disk_size":"20M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.8,"disk_size":"11.5M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.8,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.9,"disk_size":"11.2M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.7,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.6,"disk_size":"17.3M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.6,"disk_size":"18M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}}