Colour Science is a comprehensive open-source Python package providing a collection of algorithms and datasets for colour science applications, including colourspace conversions, colour appearance models, and spectral computations. It's currently at version 0.4.7 and maintains an active development cycle with frequent alpha milestones and releases, often introducing new features and compatibility updates.
pip install colour-scienceVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates a basic colourspace conversion from sRGB to XYZ and then to CIE Lab using the `colour` library. It showcases how to import the library and use its primary conversion functions with NumPy arrays.
Ensure your Python environment is >=3.11 and <3.15. Upgrade Python if necessary, or use a compatible older version of 'colour-science' if specific Python versions are required.
For existing projects, verify all required optional dependencies are explicitly listed in your project's requirements or installed via `pip install "colour-science[all]"`.
If you rely on graph visualization features, ensure `pydot` is installed (`pip install pydot`) and update any code that might have directly interacted with `pygraphviz` utilities, though the library generally abstracts this.
Ensure `Numpy` is updated to a modern, supported version. The library aims for broad `Numpy` compatibility but always benefits from recent `Numpy` releases.
If you encountered this issue, upgrading to v0.4.7 or later will remove the unintended `trimesh` dependency unless explicitly requested as an optional extra.
First, uninstall any conflicting 'colour' packages: `pip uninstall colour`. Then, ensure `colour-science` is correctly installed: `pip install colour-science`. Finally, import the library using `import colour`.
Upgrade `colour-science` to the latest version to access newer APIs: `pip install --upgrade colour-science`. If a `colour` package conflict is suspected, resolve it as described in the `ModuleNotFoundError` fix.
Before passing the spectral data to the conversion function, resample or interpolate it to one of the specified measurement intervals (1, 5, 10, or 20 nm). The library provides utilities for spectral data manipulation.
Update `colour-science` and `numpy` to their latest stable versions: `pip install --upgrade colour-science numpy`. This issue was a known bug in older releases that has since been addressed.