Skip to main content

Toolkit for recommender systems research, teaching, and more.

Project description

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://lkpy.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). Before setting up to work on LensKit, you therefore need:

  • Git
  • uv
  • rustup and a working Rust compiler (rustup install stable)
  • A working C compiler compatible with Python
    • On Windows, this is either Visual Studio (with C++ development) or the Visual C++ Build Tools. See the Rustup Windows install instructions for details.
    • On Mac, install Xcode.
    • On Linux, see your system package manager instructions.
Windows

On Windows, you can install dependencies (except for the Visual C++ tools) with winget:

> winget install Git.Git astral-sh.uv Rustlang.Rustup
> rustup install stable-msvc
Mac

On Mac, you can install the dependencies with Homebrew:

$ brew install git uv rustup

Once you have the dependencies installed, set up your LensKit development environment:

$ uv venv -p 3.12
$ uv sync

If you want all extras (may not work on Windows), do:

$ uv sync --all-extras

You can then activate the virtual environment to have the tools available and run tools like pytest:

$ . ./.venv/bin/activate

Testing Changes

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

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.

Project details


Release history Release notifications | RSS feed

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.2.1.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.2.1-cp314-cp314t-manylinux_2_28_x86_64.whl (9.9 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ x86-64

lenskit-2026.2.1-cp314-cp314t-manylinux_2_28_aarch64.whl (9.4 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.14tmacOS 11.0+ ARM64

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

Uploaded CPython 3.12+Windows x86-64

lenskit-2026.2.1-cp312-abi3-manylinux_2_28_x86_64.whl (9.9 MB view details)

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

lenskit-2026.2.1-cp312-abi3-manylinux_2_28_aarch64.whl (9.4 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ ARM64

lenskit-2026.2.1-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.2.1.tar.gz.

File metadata

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

File hashes

Hashes for lenskit-2026.2.1.tar.gz
Algorithm Hash digest
SHA256 7751faa0fb4ebe5f9ae3e0f0d47d80800869b138757186e1ab4161ec3d58a263
MD5 331156165e82808d7e612d399eb38d3a
BLAKE2b-256 f77a0348174212e4bb476ff52aa884967e4db0e3c1b97644cd3c12f6337c6eda

See more details on using hashes here.

Provenance

The following attestation bundles were made for lenskit-2026.2.1.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.2.1-cp314-cp314t-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lenskit-2026.2.1-cp314-cp314t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 417e27bdc69f722a6f0c782e4274635034d34f40a2766e17fcbc001e934839d7
MD5 83328d11487ffb5bfbecff38f8fddff0
BLAKE2b-256 b5c8ab3d37e995af84678085abecc5d4a4f84acde19197d4fa03eb2930b1ece8

See more details on using hashes here.

Provenance

The following attestation bundles were made for lenskit-2026.2.1-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.2.1-cp314-cp314t-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lenskit-2026.2.1-cp314-cp314t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a68ac6fa88b169a65cc3046238c6774aab958a62bebe822d379682c425fab6f9
MD5 b2b36a404b04813b47c1255b6653fcd2
BLAKE2b-256 1d779e1024cded490d62458b6ca546543d57254df7503ed19e08d010080a48dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for lenskit-2026.2.1-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.2.1-cp314-cp314t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lenskit-2026.2.1-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 786ab632ae5027e69e8a0440a0eac559139cb9ce10035128ed85cded4998962f
MD5 3f0f72bc9e9566848970e51d1f3b0db2
BLAKE2b-256 fc672b2e8ecf6975eb900da30ada677e780810bb2d13d99fe7b96b9bcab88ccc

See more details on using hashes here.

Provenance

The following attestation bundles were made for lenskit-2026.2.1-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.2.1-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: lenskit-2026.2.1-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/6.1.0 CPython/3.13.12

File hashes

Hashes for lenskit-2026.2.1-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e867371e1f8a2b5b682f4b0800a78577c022237c766c9403ce35071c24ecaf79
MD5 57d74d75aa57ce19bfd6bb0fd91c58d1
BLAKE2b-256 1f2622c597c5d04c623a1cd8551cb5997d24c1b29e8e3940d19db70a8664d0bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for lenskit-2026.2.1-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.2.1-cp312-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lenskit-2026.2.1-cp312-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 eb03aa82e6f57b6622b4da0a76b14dd89649a06d17b7c4391b1c0b871604368b
MD5 bab64383ae3695e46bd45726ddb79920
BLAKE2b-256 36c4935e5d3ada72d8263ca3819c89db008ef55ff7410d5669747a4c6851f765

See more details on using hashes here.

Provenance

The following attestation bundles were made for lenskit-2026.2.1-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.2.1-cp312-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lenskit-2026.2.1-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f720eec124411dc86327d0c6c87412da998a21b5abf98c6158031284c5eb2070
MD5 816c67e5180a94d057a286f57ef4b3c9
BLAKE2b-256 4952329db53ab4229e8c2ba2beeb8ad5d78b579130290d03855947c68abb066d

See more details on using hashes here.

Provenance

The following attestation bundles were made for lenskit-2026.2.1-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.2.1-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lenskit-2026.2.1-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 19e6892c6cc6411c6b0ee10f42c68e7b05089c79b5b4b585a05800c8a83af904
MD5 4bcd180aee577dd683c4b199d8b1db42
BLAKE2b-256 9869459d324a106b1beb3c83860ebd1f59bf43875621364a9d101f03b264bc16

See more details on using hashes here.

Provenance

The following attestation bundles were made for lenskit-2026.2.1-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.

Supported by

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