Skip to main content

Python recommendation tools

Automatic Tests codecov Scientific Python Ecosystem Coordination PyPI - Version Conda Version

LensKit is a set of Python tools for experimenting with and studying recommender systems. It provides support for training, running, and evaluating recommender algorithms in a flexible fashion suitable for research and education.

LensKit for Python (LKPY) is the successor to the Java-based LensKit project.

[!IMPORTANT] If you use LensKit for Python in published research, please cite:

Michael D. Ekstrand. 2020. LensKit for Python: Next-Generation Software for Recommender Systems Experiments. In Proceedings of the 29th ACM International Conference on Information and Knowledge Management (CIKM '20). DOI:10.1145/3340531.3412778. arXiv:1809.03125 [cs.IR].

[!NOTE]

LensKit had significant changes in the 2025.1 release. See the Migration Guide for details.

Installing

To install the current release with uv (recommended):

$ uv pip install lenskit

Or, to add it to your project's dependencies and virtual environment:

$ uv add lenskit

Classic pip also works:

$ python -m pip install lenskit

Then see Getting Started

Conda Packages

You can also install LensKit from conda-forge with pixi:

$ pixi add lenskit

Or conda:

$ conda install -c conda-forge lenskit

Development Version

To use the latest development version, you have two options. You can install directly from GitHub:

$ uv pip install -U git+https://github.com/lenskit/lkpy

Or you can use our PyPI index, by adding to pyproject.toml:

[[tool.uv.index]]
name = "lenskit"
url = "https://pypi.lenskit.org/lenskit-dev/"

Binary wheels of LensKit development (and release) versions are automatically pushed to this index, although they are not guaranteed to be permanently available. Reproducible code should generally depend on released versions published to PyPI.

Simplifying PyTorch installation

We also provide mirrors of the PyTorch package repositories that are filtered to only include PyTorch and directly supporting dependencies, without other packages that conflict with or mask packages from PyPI, and with fallbacks for other platforms (i.e., our CUDA indices include CPU-only MacOS packages). This makes it easier to install specific versions of PyTorch in your project with the index priority and fallthrough logic implemented by uv. To make your project only use CPU-based PyTorch, you can add to pyproject.toml:

[[tool.uv.index]]
name = "torch-cpu"
url = "https://pypi.lenskit.org/torch/cpu/"

Or CUDA 12.8:

[[tool.uv.index]]
name = "torch-gpu"
url = "https://pypi.lenskit.org/torch/cu128/"

These indices provide the same package distributions as the official PyTorch repositories (in fact, they link directly to the PyTorch packages). They are just an alternate index view that reduces some package conflicts.

Developing

To contribute to LensKit, clone or fork the repository, get to work, and submit a pull request. We welcome contributions from anyone; if you are looking for a place to get started, see the issue tracker.

Our development workflow is documented in the wiki; the wiki also contains other information on developing LensKit. User-facing documentation is at https://lenskit.org.

We use uv for developing LensKit and managing development environments. Our pyproject.toml file contains the Python development dependencies; you also need a working Rust compiler (typically via rustup). We provide Mise configuration to automatically install everything needed, including uv and rust.

The easiest way to work on LensKit is to use the devcontainer — in Visual Studio Code, Zed, and other editors supporting Dev Containers, just re-open the project in a dev container, and the necessary software will be automatically installed.

[!NOTE]

The Rust compiler needs some memory to work. If your Docker environment is set to a very small memory capacity (e.g. Colima's default of 2GB), the build will fail. Make sure your Docker has at least 4, preferably 8, GB of memory.

[!NOTE]

VS Code may try to connect to Python before the dev container has finished setting up the software dependencies, and prompt you to automatically install Python. Don't click this — let the container setup do it.

[!NOTE]

The dev container is the only supported way to develop on Windows — while LensKit works and is regularly tested on Windows, we have not invested time in making sure the development environment works on Windows without the dev container.

If you want to set up yourself, we recommend using Mise:

$ mise trust
$ mise install
$ uv sync

mise install will automatically install uv, rust, development support tools and the Git pre-commit hooks (managed with hk). You will also need a working C compiler (on macOS, install Xcode or the Xcode command-line tools).

If you want to use a specific Python version, select it with uv venv or uv sync:

$ uv venv -p 3.14t
$ uv sync

If you want all extras, do:

$ uv sync --all-extras

Testing Changes

You should always test your changes by running the LensKit test suite:

uv run pytest tests

If you want to use your changes in a LensKit experiment, you can locally install your modified LensKit into your experiment's environment. We recommend using separate environments for LensKit development and for each experiment; you will need to install the modified LensKit into your experiment's repository:

uv pip install -e /path/to/lkpy

Resources

Acknowledgements

This material is based upon work supported by the National Science Foundation under Grant No. IIS 17-51278. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lenskit-2026.3.0.tar.gz (3.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

lenskit-2026.3.0-cp314-cp314t-manylinux_2_28_x86_64.whl (10.0 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ x86-64

lenskit-2026.3.0-cp314-cp314t-manylinux_2_28_aarch64.whl (9.5 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ ARM64

lenskit-2026.3.0-cp314-cp314t-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

lenskit-2026.3.0-cp312-abi3-win_amd64.whl (3.4 MB view details)

Uploaded CPython 3.12+Windows x86-64

lenskit-2026.3.0-cp312-abi3-manylinux_2_28_x86_64.whl (10.0 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ x86-64

lenskit-2026.3.0-cp312-abi3-manylinux_2_28_aarch64.whl (9.5 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ ARM64

lenskit-2026.3.0-cp312-abi3-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

File details

Details for the file lenskit-2026.3.0.tar.gz.

File metadata

  • Download URL: lenskit-2026.3.0.tar.gz
  • Upload date:
  • Size: 3.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for lenskit-2026.3.0.tar.gz
Algorithm Hash digest
SHA256 169a1b254c3c9378b61451bef82118a5391adf3da9e3126b51f78eb2d7329463
MD5 7bd6d24fc4c64ffc3f2db9062139b977
BLAKE2b-256 9c9d4d3f07d664f32a8e36d8303155630c2fbe2e20f5492088e5c6f979446e82

See more details on using hashes here.

Provenance

The following attestation bundles were made for lenskit-2026.3.0.tar.gz:

Publisher: package.yml on lenskit/lkpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lenskit-2026.3.0-cp314-cp314t-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lenskit-2026.3.0-cp314-cp314t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8b241d27354ce3239ff79202508b05eaba35431a4814dc60511f6185cf4cee6f
MD5 1e8c91ac9ee97c9a62955803b689d47e
BLAKE2b-256 4814667cf6e533abd78e344a2022504bdabca98dcc1c439200dcc57ef1fb829f

See more details on using hashes here.

Provenance

The following attestation bundles were made for lenskit-2026.3.0-cp314-cp314t-manylinux_2_28_x86_64.whl:

Publisher: package.yml on lenskit/lkpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lenskit-2026.3.0-cp314-cp314t-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lenskit-2026.3.0-cp314-cp314t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f251f8e8d47ddce4967520a3bd7fc6768dc5aba939f8525bc29c0aaae02550c0
MD5 e0847c166cad8089747acb68d10a1dc6
BLAKE2b-256 2042f9cbd3742cefe695107f22f259163c881dadcd472bf55a6cc04f7f8b59dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for lenskit-2026.3.0-cp314-cp314t-manylinux_2_28_aarch64.whl:

Publisher: package.yml on lenskit/lkpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lenskit-2026.3.0-cp314-cp314t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lenskit-2026.3.0-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dbb4f5cbbfbfbe71638b309a809e81d73b69351d04301bc6b356d7bb32541022
MD5 e4655ab756f602a753bbd4985d28640c
BLAKE2b-256 a44a21ae55e0ea8bfe4e323904a43f23df77bc9690b19d4dafb5544bfecbe35a

See more details on using hashes here.

Provenance

The following attestation bundles were made for lenskit-2026.3.0-cp314-cp314t-macosx_11_0_arm64.whl:

Publisher: package.yml on lenskit/lkpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lenskit-2026.3.0-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: lenskit-2026.3.0-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.4 MB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for lenskit-2026.3.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e7f1dde51504f042a58b9c815eae9468338ce1eb0227f34295d1100eefd8bcfa
MD5 7aaf54473eb83d5c4594ce7448425214
BLAKE2b-256 cd9a40473e5349486f3efda1e23e2edcef1c5c9f85ba1b662c6e3f5c41d23798

See more details on using hashes here.

Provenance

The following attestation bundles were made for lenskit-2026.3.0-cp312-abi3-win_amd64.whl:

Publisher: package.yml on lenskit/lkpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lenskit-2026.3.0-cp312-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lenskit-2026.3.0-cp312-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 494485a86e5dbeeaa022c21fa9c630e5d84e2dda40d389be157e7771f1b4565a
MD5 8a88fc71846cf0424b3da36db1464b50
BLAKE2b-256 1d1f59f12e6f7807adc897df8be1ff9182d64122b1050051a0c28e862e0bc33a

See more details on using hashes here.

Provenance

The following attestation bundles were made for lenskit-2026.3.0-cp312-abi3-manylinux_2_28_x86_64.whl:

Publisher: package.yml on lenskit/lkpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lenskit-2026.3.0-cp312-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lenskit-2026.3.0-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4888d2dbe3f970de28eb795b0c20e219a723c48d63200d5eb1deb1aca3de9332
MD5 aed51c6073a65c14f0d86ab90dffb8d0
BLAKE2b-256 6b356f48a422c042b4d223aec5dfbc177ac0fb6e5a16abb9eff283c25bd12880

See more details on using hashes here.

Provenance

The following attestation bundles were made for lenskit-2026.3.0-cp312-abi3-manylinux_2_28_aarch64.whl:

Publisher: package.yml on lenskit/lkpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lenskit-2026.3.0-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lenskit-2026.3.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2a1b3d4aee761cc84aeb2459d8bad71b29d66405fe7ba6bbcadd88981f40ee5d
MD5 77241d2ad57a4f8a286381631540ec32
BLAKE2b-256 288873053750f476ded95c53d2912be78d5b8fc64ec8140a1b98b8901dd24754

See more details on using hashes here.

Provenance

The following attestation bundles were made for lenskit-2026.3.0-cp312-abi3-macosx_11_0_arm64.whl:

Publisher: package.yml on lenskit/lkpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page