Skip to main content

LightFM Next

LightFM logo

A Python 3.12+ compatible fork of the original LightFM recommendation library.

Build status
Linux & macOS (3.8-3.12) GitHub Actions

PyPI

Note: This is a community-maintained fork that provides Python 3.12+ compatibility by fixing Cython 3.0+ build issues. All credit goes to the original LightFM authors. If you're using Python < 3.12, consider using the original LightFM package.

LightFM is a Python implementation of a number of popular recommendation algorithms for both implicit and explicit feedback, including efficient implementation of BPR and WARP ranking losses. It's easy to use, fast (via multithreaded model estimation), and produces high quality results.

It also makes it possible to incorporate both item and user metadata into the traditional matrix factorization algorithms. It represents each user and item as the sum of the latent representations of their features, thus allowing recommendations to generalise to new items (via item features) and to new users (via user features).

For more details, see the Documentation.

Need help? Contact me via email, Twitter, or Gitter.

Installation

For Python 3.12+

Install lightfm-next from PyPI:

pip install lightfm-next

Note: Windows support is not available yet. Use Linux or macOS.

For Python < 3.12

Use the original LightFM package:

pip install lightfm

or Conda:

conda install -c conda-forge lightfm

Migration from original LightFM

lightfm-next is a drop-in replacement for the original LightFM. Simply replace your installation:

# Replace this
pip uninstall lightfm
pip install lightfm-next

No code changes required - all imports and APIs remain identical:

from lightfm import LightFM  # Works exactly the same

Quickstart

Fitting an implicit feedback model on the MovieLens 100k dataset is very easy:

from lightfm import LightFM
from lightfm.datasets import fetch_movielens
from lightfm.evaluation import precision_at_k

# Load the MovieLens 100k dataset. Only five
# star ratings are treated as positive.
data = fetch_movielens(min_rating=5.0)

# Instantiate and train the model
model = LightFM(loss='warp')
model.fit(data['train'], epochs=30, num_threads=2)

# Evaluate the trained model
test_precision = precision_at_k(model, data['test'], k=5).mean()

Articles and tutorials on using LightFM

  1. Learning to Rank Sketchfab Models with LightFM
  2. Metadata Embeddings for User and Item Cold-start Recommendations
  3. Recommendation Systems - Learn Python for Data Science
  4. Using LightFM to Recommend Projects to Consultants

How to cite

Please cite LightFM if it helps your research. You can use the following BibTeX entry:

@inproceedings{DBLP:conf/recsys/Kula15,
  author    = {Maciej Kula},
  editor    = {Toine Bogers and
               Marijn Koolen},
  title     = {Metadata Embeddings for User and Item Cold-start Recommendations},
  booktitle = {Proceedings of the 2nd Workshop on New Trends on Content-Based Recommender
               Systems co-located with 9th {ACM} Conference on Recommender Systems
               (RecSys 2015), Vienna, Austria, September 16-20, 2015.},
  series    = {{CEUR} Workshop Proceedings},
  volume    = {1448},
  pages     = {14--21},
  publisher = {CEUR-WS.org},
  year      = {2015},
  url       = {http://ceur-ws.org/Vol-1448/paper4.pdf},
}

Development

Pull requests are welcome. To install for development:

  1. Clone the repository: git clone https://github.com/midodimori/lightfm-next.git
  2. Install UV: curl -LsSf https://astral.sh/uv/install.sh | sh
  3. Install dependencies: cd lightfm-next && uv sync --extra dev --extra lint
  4. Run all tests and linting: make test-all

Available make commands:

  • make install - Install dependencies and build extensions
  • make lint - Run flake8 linting
  • make test - Run pytest
  • make test-basic - Run basic functionality test
  • make test-all - Run complete test suite (same as CI)

When making changes to .pyx extension files, run uv run python setup.py build_ext --inplace to rebuild extensions.

Metadata

Release files for lightfm-next 1.19.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lightfm-next 1.19.0
File Size Uploaded
lightfm_next-1.19.0.tar.gz 426.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for lightfm-next 1.19.0
File
lightfm_next-1.19.0-cp313-cp313-musllinux_1_2_x86_64.whl CPython 3.13 CPython 3.13 Linux musl 1.2+ x86-64 Details
lightfm_next-1.19.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
lightfm_next-1.19.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
lightfm_next-1.19.0-cp313-cp313-macosx_10_13_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.13+ x86-64 Details
lightfm_next-1.19.0-cp312-cp312-musllinux_1_2_x86_64.whl CPython 3.12 CPython 3.12 Linux musl 1.2+ x86-64 Details
lightfm_next-1.19.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
lightfm_next-1.19.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
lightfm_next-1.19.0-cp312-cp312-macosx_10_13_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.13+ x86-64 Details

Total release size: 10.0 MB

Release files / lightfm_next-1.19.0.tar.gz

Download URL lightfm_next-1.19.0.tar.gz
Size 426.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2f02e0b1bc1338373d3086773e258b2bbee98352818bbba189a15ce7111f3781
BLAKE2b-256 checksum
How to use checksums
d22e964b86556b19d8bef7866f69730514e7a538fa7e196ddbd8df9bc358de02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2025.

Transparency log

Release files / lightfm_next-1.19.0-cp313-cp313-musllinux_1_2_x86_64.whl

Download URL lightfm_next-1.19.0-cp313-cp313-musllinux_1_2_x86_64.whl
Size 1.9 MB
Tags CPython 3.13 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
a5623db43e40c16782110a371d2b22e150dbf59feb0d6df2df8ce72b6e58389b
BLAKE2b-256 checksum
How to use checksums
87ee6709aaa2aa4f65b5bc640f4394532d4ec873b0db401bdbe8fbe1c96e9e17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2025.

Transparency log

Release files / lightfm_next-1.19.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lightfm_next-1.19.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.8 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a78fe727d8aa28992fb6735f44d67c95841c06008221cb203e80430657504cde
BLAKE2b-256 checksum
How to use checksums
156455cb91edadd4e14f00c001b0b439e755081c0ba6f693e149866e8583f84d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2025.

Transparency log

Release files / lightfm_next-1.19.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL lightfm_next-1.19.0-cp313-cp313-macosx_11_0_arm64.whl
Size 541.8 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c74d6741df62b9ece1212bb856a5964387eccec00bc2eb55681fd94f291510b3
BLAKE2b-256 checksum
How to use checksums
5e3a488c528e11b3b4216b0e7b8ba935c3b928cb4c8b42658384f06c6444c2ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2025.

Transparency log

Release files / lightfm_next-1.19.0-cp313-cp313-macosx_10_13_x86_64.whl

Download URL lightfm_next-1.19.0-cp313-cp313-macosx_10_13_x86_64.whl
Size 543.8 kB
Tags CPython 3.13 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
c05e8a8ed2504dc03150d0965ab918b1e7d4360c02ed72fafcb84d64d117e910
BLAKE2b-256 checksum
How to use checksums
7285c6d8fc714f75d509bbce3ba10e44a78ec41fa7a00b9b02944b9247c504d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2025.

Transparency log

Release files / lightfm_next-1.19.0-cp312-cp312-musllinux_1_2_x86_64.whl

Download URL lightfm_next-1.19.0-cp312-cp312-musllinux_1_2_x86_64.whl
Size 1.9 MB
Tags CPython 3.12 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
2ca2b3e4b3d931426ac343232797c8c6c56bee6fce499019c4b637827ac8af9d
BLAKE2b-256 checksum
How to use checksums
b868e2555d87f85a79eba0ab6f164e3f2a91c8659fdf048ce54bead527880834
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2025.

Transparency log

Release files / lightfm_next-1.19.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lightfm_next-1.19.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.8 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
84d81163ef06b21a90d28596417e81422460a16925cd2bd6143b34da9146c12f
BLAKE2b-256 checksum
How to use checksums
84bd18c6bc6c16e91028d1725a8e185f6465afb379b53effde485cc3bca28a42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2025.

Transparency log

Release files / lightfm_next-1.19.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL lightfm_next-1.19.0-cp312-cp312-macosx_11_0_arm64.whl
Size 542.8 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
262264c53274d78557bcf7c9e47c3b46baa7033612ab88ee56510506074cd68a
BLAKE2b-256 checksum
How to use checksums
0d89f8a0f26ba22753b627d82b19fcee53a5fb6c992796b63482b52654c0eaea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2025.

Transparency log

Release files / lightfm_next-1.19.0-cp312-cp312-macosx_10_13_x86_64.whl

Download URL lightfm_next-1.19.0-cp312-cp312-macosx_10_13_x86_64.whl
Size 544.7 kB
Tags CPython 3.12 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
eef6d3894515ecfba44ce72f1a346d9d0f995e2ea2352b06fb55bc9e06e7af76
BLAKE2b-256 checksum
How to use checksums
0645008eb39c8b2b8ce26fa5d87646798b39827320793e7794bfb8e4dc81dc0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.19.0 This release

9 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page