Libsass is a Python binding for LibSass, the C/C++ port of the original Sass CSS preprocessor. It allows Python developers to compile Sass/SCSS files to CSS without needing a Ruby or Node.js runtime. While the `libsass-python` wrapper is actively maintained and currently at version 0.23.0 (released January 6, 2024), the underlying LibSass C/C++ library reached its official End-of-Life in October 2025 and is no longer receiving updates.
pip install libsassVerified import paths — ran on the pinned version, not inferred.
Compiles a SCSS string to a compressed CSS string. The `compile` function can also take `filename` or `dirname` arguments for file-based compilation.
Migrate to `sass-embedded-python` (or another Dart Sass wrapper) for future-proof Sass compilation.
Ensure your project runs on Python 3.8 or newer (as required by PyPI metadata).
Use the `pysassc` command-line tool, which provides SassC-compliant functionality, or use the `sass.compile()` API directly.
Ensure a compatible C++ compiler is installed and configured in your build environment (e.g., `build-essential` on Debian/Ubuntu, Xcode Command Line Tools on macOS, Visual Studio Build Tools on Windows).
Review the Sass documentation on LibSass migration to understand potential behavioral differences when using `libsass-python` vs. Dart Sass. Consider using the Sass migrator tools if transitioning.
Always use boolean values (`True` or `False`) for the `source_comments` parameter. String values are deprecated and will be obsolete.
First, check for conflicting 'sass' packages using `pip freeze | grep sass`. If another 'sass' package is found, uninstall it. Ensure you are importing `sass` from the `libsass` package. If using an older version, try `sass.compile_string(scss_code)` or `sass.compile_file(filepath)` instead of `sass.compile()`.
Install the appropriate Microsoft Visual C++ Redistributable for Visual Studio (e.g., 2015, 2017, 2019, or 2022, depending on your Python version's build toolchain) from the official Microsoft website.
Ensure you have the necessary C++ compiler installed (e.g., Build Tools for Visual Studio on Windows, `build-essential` on Debian/Ubuntu, Xcode Command Line Tools on macOS). Then, uninstall and reinstall `libsass` using `pip uninstall libsass && pip install libsass` to force a rebuild of the extension module.
The most reliable fix is to ensure `pip` can install a pre-built wheel for your system. If that's not possible, a workaround can be to temporarily downgrade `setuptools` to a version prior to 74 (e.g., `pip install setuptools<74`) before installing `libsass`, and then optionally upgrading `setuptools` again.
No dependency data recorded yet.