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.1.0b1.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.1.0b1-cp314-cp314t-manylinux_2_28_x86_64.whl (9.6 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ x86-64

lenskit-2026.1.0b1-cp314-cp314t-manylinux_2_28_aarch64.whl (9.1 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ ARM64

lenskit-2026.1.0b1-cp314-cp314t-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

lenskit-2026.1.0b1-cp312-abi3-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.12+Windows x86-64

lenskit-2026.1.0b1-cp312-abi3-manylinux_2_28_x86_64.whl (9.7 MB view details)

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

lenskit-2026.1.0b1-cp312-abi3-manylinux_2_28_aarch64.whl (9.1 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ ARM64

lenskit-2026.1.0b1-cp312-abi3-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

File details

Details for the file lenskit-2026.1.0b1.tar.gz.

File metadata

  • Download URL: lenskit-2026.1.0b1.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.1.0b1.tar.gz
Algorithm Hash digest
SHA256 a596d8f9371a97a187788383f34b2035fa57ce8eae115cc9e427a0cd8bfecb88
MD5 2849f302d115d1ae676a6fdeeb28dcc5
BLAKE2b-256 d829542ea91baa3ed7bb1a002404e9eebc4d209bcb01452e98c57450b1bcdc64

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lenskit-2026.1.0b1-cp314-cp314t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 74bc6c9b1b116d2c75e8a3f228fdf1bffea327cc2b7c30b6132c0d73df46a34c
MD5 133630a93d0e8512eb4d29f0513eb706
BLAKE2b-256 cf8584852b8a5d0e6cffef178e16bbfb8cfb552c5a7586db4ceacf72069ad2a7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lenskit-2026.1.0b1-cp314-cp314t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ea5e935836d069b91f9c6db80d6fec0fd28a66d2cf451d3398c8c3c04cda524b
MD5 e9937a7d1def073e3d53495b2225018a
BLAKE2b-256 ecfb4ca2249dc8ac4af2170ee24078872c5370581031ad83fc5cf669fd6d8dd7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lenskit-2026.1.0b1-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7bdb556567f28d79ac1685c124682e5ab6a2cee3a812d84f041fc3920e85b0b5
MD5 d4dfc186f62d03484edc873cb581669d
BLAKE2b-256 0183190b66f8b1c561693060603225702faa2df801d196d4de709d5d261527f5

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: lenskit-2026.1.0b1-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.3 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.1.0b1-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 99fb5a627d1f465c41455360fd1692b134b761c930ec815222c976a7f17391ea
MD5 65701e1e9d0aeba6fd20d9390808fc58
BLAKE2b-256 9999b0f14c03f0ac992c5fe9d105566768dd566f78dae22bff43f48d159b5741

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lenskit-2026.1.0b1-cp312-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5dc0b20b72a53dce04714a11039d8f6a8a7bfee15deb1ca5eefe9e59fb296d97
MD5 24f952eca9f06cfbec869a6bec3f6972
BLAKE2b-256 8eb85639f5bb984cc31b957ca36a7f9e096694a1da209819fb993665aa997b02

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lenskit-2026.1.0b1-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 497e09c0d42459510c409962252aefa5a98d45e11d0ffaf5264ce67bf11e1426
MD5 ee538d38180ff6cfe4ef9c2ee05b6ae6
BLAKE2b-256 285a81476667b1eabab1c1506f90ee2e9b71aedb003895c4e07f6271c57aeac5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lenskit-2026.1.0b1-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3ede6b1be34930bc251d5707fb7a509434dae99fcc3fd316f516584577016254
MD5 73b2e491a01475ed11159dd077fbe910
BLAKE2b-256 28281967e0dd9a2837c9257b210d292d52140b41dcd5e6bf8355d4e4c016962c

See more details on using hashes here.

Provenance

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