Toolkit for recommender systems research, teaching, and more.
Project description
Python recommendation tools
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
uvrustupand 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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lenskit-2025.6.3.tar.gz.
File metadata
- Download URL: lenskit-2025.6.3.tar.gz
- Upload date:
- Size: 3.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5416dad68ce6f2a7004b3fbce87b4022914c0d03be710d7e0476905e58449c7e
|
|
| MD5 |
ff04b5f2a3f86e3976802a04f0934f2b
|
|
| BLAKE2b-256 |
b6b43957babd753d2089ce898976665708e99120cb420033f1951ad17dc2386c
|
Provenance
The following attestation bundles were made for lenskit-2025.6.3.tar.gz:
Publisher:
package.yml on lenskit/lkpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lenskit-2025.6.3.tar.gz -
Subject digest:
5416dad68ce6f2a7004b3fbce87b4022914c0d03be710d7e0476905e58449c7e - Sigstore transparency entry: 829414843
- Sigstore integration time:
-
Permalink:
lenskit/lkpy@88404237c9031df1a7ec9d0de026df80b01db708 -
Branch / Tag:
refs/tags/v2025.6.3 - Owner: https://github.com/lenskit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
package.yml@88404237c9031df1a7ec9d0de026df80b01db708 -
Trigger Event:
release
-
Statement type:
File details
Details for the file lenskit-2025.6.3-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: lenskit-2025.6.3-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.11+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
973ab573d3789c7fb7f9182b1b0f90ea2a3450e92ed28a0ab8128c8b487906d2
|
|
| MD5 |
1938a53ad01d7c84810a783d3de2313b
|
|
| BLAKE2b-256 |
ddcde9e8f01e539ed64c729d2a0c225be1e7d537f77576017f5df94ba3b03471
|
Provenance
The following attestation bundles were made for lenskit-2025.6.3-cp311-abi3-win_amd64.whl:
Publisher:
package.yml on lenskit/lkpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lenskit-2025.6.3-cp311-abi3-win_amd64.whl -
Subject digest:
973ab573d3789c7fb7f9182b1b0f90ea2a3450e92ed28a0ab8128c8b487906d2 - Sigstore transparency entry: 829414862
- Sigstore integration time:
-
Permalink:
lenskit/lkpy@88404237c9031df1a7ec9d0de026df80b01db708 -
Branch / Tag:
refs/tags/v2025.6.3 - Owner: https://github.com/lenskit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
package.yml@88404237c9031df1a7ec9d0de026df80b01db708 -
Trigger Event:
release
-
Statement type:
File details
Details for the file lenskit-2025.6.3-cp311-abi3-win32.whl.
File metadata
- Download URL: lenskit-2025.6.3-cp311-abi3-win32.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.11+, Windows x86
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46e97b0a0c8e54ba9261ecc340c36163cfc674f0af26013f83aa16f43c7dec33
|
|
| MD5 |
46929c13c4a255ae3e01de1c1fc8bb9c
|
|
| BLAKE2b-256 |
ad6444c04e29ad396c219537c82a9d88b67aa35389243b116895e6a35f8d9595
|
Provenance
The following attestation bundles were made for lenskit-2025.6.3-cp311-abi3-win32.whl:
Publisher:
package.yml on lenskit/lkpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lenskit-2025.6.3-cp311-abi3-win32.whl -
Subject digest:
46e97b0a0c8e54ba9261ecc340c36163cfc674f0af26013f83aa16f43c7dec33 - Sigstore transparency entry: 829414859
- Sigstore integration time:
-
Permalink:
lenskit/lkpy@88404237c9031df1a7ec9d0de026df80b01db708 -
Branch / Tag:
refs/tags/v2025.6.3 - Owner: https://github.com/lenskit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
package.yml@88404237c9031df1a7ec9d0de026df80b01db708 -
Trigger Event:
release
-
Statement type:
File details
Details for the file lenskit-2025.6.3-cp311-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: lenskit-2025.6.3-cp311-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 7.8 MB
- Tags: CPython 3.11+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1134186b3553d819d575e5e9cb9de07a8e579d7ca76017a369481f2a539ed400
|
|
| MD5 |
ab9bc62219856401d33891a294778db7
|
|
| BLAKE2b-256 |
bd98697143f148c2214cf189bc042b432813ebcf4b6869e6433091d650caf00c
|
Provenance
The following attestation bundles were made for lenskit-2025.6.3-cp311-abi3-manylinux_2_28_x86_64.whl:
Publisher:
package.yml on lenskit/lkpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lenskit-2025.6.3-cp311-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
1134186b3553d819d575e5e9cb9de07a8e579d7ca76017a369481f2a539ed400 - Sigstore transparency entry: 829414848
- Sigstore integration time:
-
Permalink:
lenskit/lkpy@88404237c9031df1a7ec9d0de026df80b01db708 -
Branch / Tag:
refs/tags/v2025.6.3 - Owner: https://github.com/lenskit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
package.yml@88404237c9031df1a7ec9d0de026df80b01db708 -
Trigger Event:
release
-
Statement type:
File details
Details for the file lenskit-2025.6.3-cp311-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: lenskit-2025.6.3-cp311-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 7.3 MB
- Tags: CPython 3.11+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b233fc9f0dacbf955d1aac8053a1c44d88d8344527671dba8cf40c0d005f6f27
|
|
| MD5 |
45a8dc1b212a87998b24dff34f2446bb
|
|
| BLAKE2b-256 |
4de77cfeb313d39ef7a62ab90b05be577d1088f48f2ada3aa3c5603145dae260
|
Provenance
The following attestation bundles were made for lenskit-2025.6.3-cp311-abi3-manylinux_2_28_aarch64.whl:
Publisher:
package.yml on lenskit/lkpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lenskit-2025.6.3-cp311-abi3-manylinux_2_28_aarch64.whl -
Subject digest:
b233fc9f0dacbf955d1aac8053a1c44d88d8344527671dba8cf40c0d005f6f27 - Sigstore transparency entry: 829414853
- Sigstore integration time:
-
Permalink:
lenskit/lkpy@88404237c9031df1a7ec9d0de026df80b01db708 -
Branch / Tag:
refs/tags/v2025.6.3 - Owner: https://github.com/lenskit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
package.yml@88404237c9031df1a7ec9d0de026df80b01db708 -
Trigger Event:
release
-
Statement type:
File details
Details for the file lenskit-2025.6.3-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: lenskit-2025.6.3-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9f6a0672e0308f63f7d0528680783ff3ab68e9040135b26af242ce15ae882c8
|
|
| MD5 |
2018dbdd0c525779adbc3b019b773edd
|
|
| BLAKE2b-256 |
87c9cc0611a1b433266f1ac5d477f23c46369947675e02bf0eda318b66f5de3b
|
Provenance
The following attestation bundles were made for lenskit-2025.6.3-cp311-abi3-macosx_11_0_arm64.whl:
Publisher:
package.yml on lenskit/lkpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lenskit-2025.6.3-cp311-abi3-macosx_11_0_arm64.whl -
Subject digest:
d9f6a0672e0308f63f7d0528680783ff3ab68e9040135b26af242ce15ae882c8 - Sigstore transparency entry: 829414856
- Sigstore integration time:
-
Permalink:
lenskit/lkpy@88404237c9031df1a7ec9d0de026df80b01db708 -
Branch / Tag:
refs/tags/v2025.6.3 - Owner: https://github.com/lenskit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
package.yml@88404237c9031df1a7ec9d0de026df80b01db708 -
Trigger Event:
release
-
Statement type:
File details
Details for the file lenskit-2025.6.3-cp311-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: lenskit-2025.6.3-cp311-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.11+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4416e648021a59d3528ef82671fcf86e0e7cb477668b406597ee0ec599a55f80
|
|
| MD5 |
228594431dca75ec0fee54d55409dace
|
|
| BLAKE2b-256 |
856383ac968b126a7a625ec60cc120ab1c82d98a1c1ed1d75804fd99694f4126
|
Provenance
The following attestation bundles were made for lenskit-2025.6.3-cp311-abi3-macosx_10_12_x86_64.whl:
Publisher:
package.yml on lenskit/lkpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lenskit-2025.6.3-cp311-abi3-macosx_10_12_x86_64.whl -
Subject digest:
4416e648021a59d3528ef82671fcf86e0e7cb477668b406597ee0ec599a55f80 - Sigstore transparency entry: 829414851
- Sigstore integration time:
-
Permalink:
lenskit/lkpy@88404237c9031df1a7ec9d0de026df80b01db708 -
Branch / Tag:
refs/tags/v2025.6.3 - Owner: https://github.com/lenskit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
package.yml@88404237c9031df1a7ec9d0de026df80b01db708 -
Trigger Event:
release
-
Statement type: