Loading pkgs/development/python-modules/apache-beam/default.nix +1 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ buildPythonPackage (finalAttrs: { "httplib2" "jsonpickle" "objsize" "protobuf" "pyarrow" ]; Loading pkgs/development/python-modules/streamlit/default.nix +4 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,10 @@ buildPythonPackage (finalAttrs: { build-system = [ setuptools ]; pythonRelaxDeps = [ "packaging" ]; pythonRelaxDeps = [ "packaging" "protobuf" ]; dependencies = [ altair Loading pkgs/development/python-modules/unsloth-zoo/default.nix +17 −8 Original line number Diff line number Diff line Loading @@ -25,18 +25,28 @@ tyro, }: buildPythonPackage rec { buildPythonPackage (finalAttrs: { pname = "unsloth-zoo"; version = "2026.1.3"; version = "2026.3.4"; pyproject = true; # no tags on GitHub src = fetchPypi { pname = "unsloth_zoo"; inherit version; hash = "sha256-njArRI9y6EKwZamJnQoWQIvmYzV6t0syUIi1d7DzX4U="; inherit (finalAttrs) version; hash = "sha256-24w8UV5cLG5XWrU73xfmg+Jk32zl+QSPdqXLzMtmP1E="; }; postPatch = '' substituteInPlace pyproject.toml \ --replace-fail \ "setuptools==80.9.0" \ "setuptools" \ --replace-fail \ "setuptools-scm==9.2.0" \ "setuptools-scm" ''; # pyproject.toml requires an obsolete version of protobuf, # but it is not used. # Upstream issue: https://github.com/unslothai/unsloth-zoo/pull/68 Loading @@ -44,6 +54,7 @@ buildPythonPackage rec { "datasets" "protobuf" "transformers" "trl" "torch" ]; Loading Loading @@ -78,9 +89,7 @@ buildPythonPackage rec { # No tests doCheck = false; pythonImportsCheck = [ "unsloth_zoo" ]; pythonImportsCheck = [ "unsloth_zoo" ]; meta = { description = "Utils for Unsloth"; Loading @@ -88,4 +97,4 @@ buildPythonPackage rec { license = lib.licenses.mit; maintainers = with lib.maintainers; [ hoh ]; }; } }) pkgs/development/python-modules/unsloth-zoo/dont-require-unsloth.patch +22 −14 Original line number Diff line number Diff line diff --git a/unsloth_zoo/__init__.py b/unsloth_zoo/__init__.py index 2332907..2eed5e9 100644 index 8c4404c..dc1666f 100644 --- a/unsloth_zoo/__init__.py +++ b/unsloth_zoo/__init__.py @@ -64,8 +64,6 @@ pass @@ -90,8 +90,6 @@ if (os.environ.get("UNSLOTH_COMPILE_DEBUG", "0") == "1"): from importlib.util import find_spec -if find_spec("unsloth") is None: - raise ImportError("Please install Unsloth via `pip install unsloth`!") pass del find_spec if find_spec("torch") is None: raise ImportError( "Unsloth: Pytorch is not installed. Go to https://pytorch.org/.\n"\ @@ -275,9 +273,6 @@ del remove_expandable_segments, delete_key, IS_HIP_RUNTIME, IS_TORCH_2_9_OR_NEWE del clean_expandable_segments_value del _ORIGINAL_PYTORCH_CUDA_ALLOC_CONF, _ORIGINAL_PYTORCH_HIP_ALLOC_CONF, _HAS_ORIGINAL_PYTORCH_ALLOC_CONF @@ -75,12 +73,13 @@ def get_device_type(): -if not ("UNSLOTH_IS_PRESENT" in os.environ): - raise ImportError("Please install Unsloth via `pip install unsloth`!") - try: print("🦥 Unsloth: Will patch your computer to enable 2x faster free finetuning.") except: diff --git a/unsloth_zoo/device_type.py b/unsloth_zoo/device_type.py index 11136fb..8f8dafc 100644 --- a/unsloth_zoo/device_type.py +++ b/unsloth_zoo/device_type.py @@ -209,6 +209,9 @@ def get_device_type(): return "cuda" elif hasattr(torch, "xpu") and torch.xpu.is_available(): return "xpu" + else: + # Allow import during tests + return None raise NotImplementedError("Unsloth currently only works on NVIDIA GPUs and Intel GPUs.") pass DEVICE_TYPE : str = get_device_type() -if not ("UNSLOTH_IS_PRESENT" in os.environ): - raise ImportError("Please install Unsloth via `pip install unsloth`!") pass try: # Check torch.accelerator if hasattr(torch, "accelerator"): if not torch.accelerator.is_available(): pkgs/development/python-modules/unsloth/default.nix +6 −6 Original line number Diff line number Diff line Loading @@ -51,16 +51,16 @@ let }; in buildPythonPackage rec { buildPythonPackage (finalAttrs: { pname = "unsloth"; version = "2026.1.3"; version = "2026.3.8"; pyproject = true; # Tags on the GitHub repo don't match src = fetchPypi { pname = "unsloth"; inherit version; hash = "sha256-Vq47dKdOyRm+sQmGkfEQ8vM1A1Xq7NwqyE2NGhgyK/s="; inherit (finalAttrs) version; hash = "sha256-2HXsaYhsMxNEm6ctKDZDrA9MY/fUKhAo0EPYC5RwBNc="; }; build-system = [ Loading Loading @@ -140,8 +140,8 @@ buildPythonPackage rec { meta = { description = "Finetune Llama 3.3, DeepSeek-R1 & Reasoning LLMs 2x faster with 70% less memory"; homepage = "https://github.com/unslothai/unsloth"; changelog = "https://github.com/unslothai/unsloth/releases/tag/${version}"; changelog = "https://github.com/unslothai/unsloth/releases/tag/${finalAttrs.version}"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ hoh ]; }; } }) Loading
pkgs/development/python-modules/apache-beam/default.nix +1 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ buildPythonPackage (finalAttrs: { "httplib2" "jsonpickle" "objsize" "protobuf" "pyarrow" ]; Loading
pkgs/development/python-modules/streamlit/default.nix +4 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,10 @@ buildPythonPackage (finalAttrs: { build-system = [ setuptools ]; pythonRelaxDeps = [ "packaging" ]; pythonRelaxDeps = [ "packaging" "protobuf" ]; dependencies = [ altair Loading
pkgs/development/python-modules/unsloth-zoo/default.nix +17 −8 Original line number Diff line number Diff line Loading @@ -25,18 +25,28 @@ tyro, }: buildPythonPackage rec { buildPythonPackage (finalAttrs: { pname = "unsloth-zoo"; version = "2026.1.3"; version = "2026.3.4"; pyproject = true; # no tags on GitHub src = fetchPypi { pname = "unsloth_zoo"; inherit version; hash = "sha256-njArRI9y6EKwZamJnQoWQIvmYzV6t0syUIi1d7DzX4U="; inherit (finalAttrs) version; hash = "sha256-24w8UV5cLG5XWrU73xfmg+Jk32zl+QSPdqXLzMtmP1E="; }; postPatch = '' substituteInPlace pyproject.toml \ --replace-fail \ "setuptools==80.9.0" \ "setuptools" \ --replace-fail \ "setuptools-scm==9.2.0" \ "setuptools-scm" ''; # pyproject.toml requires an obsolete version of protobuf, # but it is not used. # Upstream issue: https://github.com/unslothai/unsloth-zoo/pull/68 Loading @@ -44,6 +54,7 @@ buildPythonPackage rec { "datasets" "protobuf" "transformers" "trl" "torch" ]; Loading Loading @@ -78,9 +89,7 @@ buildPythonPackage rec { # No tests doCheck = false; pythonImportsCheck = [ "unsloth_zoo" ]; pythonImportsCheck = [ "unsloth_zoo" ]; meta = { description = "Utils for Unsloth"; Loading @@ -88,4 +97,4 @@ buildPythonPackage rec { license = lib.licenses.mit; maintainers = with lib.maintainers; [ hoh ]; }; } })
pkgs/development/python-modules/unsloth-zoo/dont-require-unsloth.patch +22 −14 Original line number Diff line number Diff line diff --git a/unsloth_zoo/__init__.py b/unsloth_zoo/__init__.py index 2332907..2eed5e9 100644 index 8c4404c..dc1666f 100644 --- a/unsloth_zoo/__init__.py +++ b/unsloth_zoo/__init__.py @@ -64,8 +64,6 @@ pass @@ -90,8 +90,6 @@ if (os.environ.get("UNSLOTH_COMPILE_DEBUG", "0") == "1"): from importlib.util import find_spec -if find_spec("unsloth") is None: - raise ImportError("Please install Unsloth via `pip install unsloth`!") pass del find_spec if find_spec("torch") is None: raise ImportError( "Unsloth: Pytorch is not installed. Go to https://pytorch.org/.\n"\ @@ -275,9 +273,6 @@ del remove_expandable_segments, delete_key, IS_HIP_RUNTIME, IS_TORCH_2_9_OR_NEWE del clean_expandable_segments_value del _ORIGINAL_PYTORCH_CUDA_ALLOC_CONF, _ORIGINAL_PYTORCH_HIP_ALLOC_CONF, _HAS_ORIGINAL_PYTORCH_ALLOC_CONF @@ -75,12 +73,13 @@ def get_device_type(): -if not ("UNSLOTH_IS_PRESENT" in os.environ): - raise ImportError("Please install Unsloth via `pip install unsloth`!") - try: print("🦥 Unsloth: Will patch your computer to enable 2x faster free finetuning.") except: diff --git a/unsloth_zoo/device_type.py b/unsloth_zoo/device_type.py index 11136fb..8f8dafc 100644 --- a/unsloth_zoo/device_type.py +++ b/unsloth_zoo/device_type.py @@ -209,6 +209,9 @@ def get_device_type(): return "cuda" elif hasattr(torch, "xpu") and torch.xpu.is_available(): return "xpu" + else: + # Allow import during tests + return None raise NotImplementedError("Unsloth currently only works on NVIDIA GPUs and Intel GPUs.") pass DEVICE_TYPE : str = get_device_type() -if not ("UNSLOTH_IS_PRESENT" in os.environ): - raise ImportError("Please install Unsloth via `pip install unsloth`!") pass try: # Check torch.accelerator if hasattr(torch, "accelerator"): if not torch.accelerator.is_available():
pkgs/development/python-modules/unsloth/default.nix +6 −6 Original line number Diff line number Diff line Loading @@ -51,16 +51,16 @@ let }; in buildPythonPackage rec { buildPythonPackage (finalAttrs: { pname = "unsloth"; version = "2026.1.3"; version = "2026.3.8"; pyproject = true; # Tags on the GitHub repo don't match src = fetchPypi { pname = "unsloth"; inherit version; hash = "sha256-Vq47dKdOyRm+sQmGkfEQ8vM1A1Xq7NwqyE2NGhgyK/s="; inherit (finalAttrs) version; hash = "sha256-2HXsaYhsMxNEm6ctKDZDrA9MY/fUKhAo0EPYC5RwBNc="; }; build-system = [ Loading Loading @@ -140,8 +140,8 @@ buildPythonPackage rec { meta = { description = "Finetune Llama 3.3, DeepSeek-R1 & Reasoning LLMs 2x faster with 70% less memory"; homepage = "https://github.com/unslothai/unsloth"; changelog = "https://github.com/unslothai/unsloth/releases/tag/${version}"; changelog = "https://github.com/unslothai/unsloth/releases/tag/${finalAttrs.version}"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ hoh ]; }; } })