diff options
| author | Ihar Hrachyshka <ihar.hrachyshka@gmail.com> | 2025-01-17 21:25:14 -0500 |
|---|---|---|
| committer | Ihar Hrachyshka <ihar.hrachyshka@gmail.com> | 2025-01-27 22:32:08 -0500 |
| commit | 6d15d203b6824564b072d8f55fe9eed1c6f7911e (patch) | |
| tree | 53b5c57a24e5c90b491fff1e31c1a5c6c79d9593 /pkgs/development/python-modules/llama-cpp-python | |
| parent | 9d2d3fd2b8f85c898873e337d0217d6503aa0d38 (diff) | |
python312Packages.llama-cpp-python: enable for Darwin
For Darwin, there's no CUDA, hence run CUDA tests only for Linux.
Also, if CUDA is used, we need gcc13 or lower, otherwise the build fails
with:
unsupported GNU version! gcc versions later than 13 are not supported!
This change also updates passthru tests so that they are defined on
linux only, since darwin has no CUDA anyway.
Diffstat (limited to 'pkgs/development/python-modules/llama-cpp-python')
| -rw-r--r-- | pkgs/development/python-modules/llama-cpp-python/default.nix | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/pkgs/development/python-modules/llama-cpp-python/default.nix b/pkgs/development/python-modules/llama-cpp-python/default.nix index ec69378235e6..ade74c97bef9 100644 --- a/pkgs/development/python-modules/llama-cpp-python/default.nix +++ b/pkgs/development/python-modules/llama-cpp-python/default.nix @@ -1,6 +1,7 @@ { lib, stdenv, + gcc13Stdenv, buildPythonPackage, fetchFromGitHub, @@ -33,6 +34,9 @@ cudaPackages ? { }, }: +let + stdenvTarget = if cudaSupport then gcc13Stdenv else stdenv; +in buildPythonPackage rec { pname = "llama-cpp-python"; version = "0.3.6"; @@ -76,6 +80,8 @@ buildPythonPackage rec { ] ); + stdenv = stdenvTarget; + dependencies = [ diskcache jinja2 @@ -99,7 +105,11 @@ buildPythonPackage rec { passthru = { updateScript = gitUpdater { rev-prefix = "v"; }; - tests.llama-cpp-python = llama-cpp-python.override { cudaSupport = true; }; + tests = lib.optionalAttrs stdenvTarget.hostPlatform.isLinux { + withCuda = llama-cpp-python.override { + cudaSupport = true; + }; + }; }; meta = { @@ -109,12 +119,6 @@ buildPythonPackage rec { license = lib.licenses.mit; maintainers = with lib.maintainers; [ kirillrdy ]; badPlatforms = [ - # Segfaults during tests: - # tests/test_llama.py .Fatal Python error: Segmentation fault - # Current thread 0x00000001f3decf40 (most recent call first): - # File "/private/tmp/nix-build-python3.12-llama-cpp-python-0.3.2.drv-0/source/llama_cpp/_internals.py", line 51 in __init__ - lib.systems.inspect.patterns.isDarwin - # cc1: error: unknown value ‘native+nodotprod+noi8mm+nosve’ for ‘-mcpu’ "aarch64-linux" ]; |
