Files
nixpkgs/pkgs/development/python-modules/gensim/default.nix
Luka Blašković fcbfba63a6 python3Packages.gensim: fix build with python 3.14
Apply piskvorky/gensim#3649 for the forkserver multiprocessing default.
2026-07-15 07:28:20 +00:00

88 lines
1.8 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
# build-system
cython,
setuptools,
# dependencies
numpy,
scipy,
smart-open,
# tests
mock,
pyemd,
pytestCheckHook,
testfixtures,
}:
buildPythonPackage (finalAttrs: {
pname = "gensim";
version = "4.4.0";
pyproject = true;
__structuredAttrs = true;
src = fetchFromGitHub {
owner = "piskvorky";
repo = "gensim";
tag = finalAttrs.version;
hash = "sha256-TXutcU43ReBj9ss9+zBJFUxb5JqVHpl+B0c7hqcJAJY=";
};
patches = [
# Fall back to serial chunkize when the multiprocessing start method is not
# "fork" (the default changed to "forkserver" on Linux with Python 3.14).
# Vendored (filtered to gensim/utils.py) from the not yet merged
# https://github.com/piskvorky/gensim/pull/3649
./python314-chunkize-forkserver.patch
];
build-system = [
cython
setuptools
];
dependencies = [
numpy
scipy
smart-open
];
nativeCheckInputs = [
mock
pyemd
pytestCheckHook
testfixtures
];
pythonImportsCheck = [ "gensim" ];
enabledTestPaths = [ "gensim/test" ];
# test_parallel is flaky under load
disabledTests = [ "test_parallel" ];
preCheck = ''
export GENSIM_DATA_DIR="$NIX_BUILD_TOP/gensim-data"
mkdir -p "$GENSIM_DATA_DIR"
export SKIP_NETWORK_TESTS=1
''
# Prevent python from importing gensim from the source files during tests
+ ''
rm gensim/__init__.py
'';
meta = {
description = "Topic-modelling library";
homepage = "https://radimrehurek.com/gensim/";
downloadPage = "https://github.com/piskvorky/gensim";
changelog = "https://github.com/RaRe-Technologies/gensim/blob/${finalAttrs.version}/CHANGELOG.md";
license = lib.licenses.lgpl21Only;
maintainers = [ ];
};
})