Hello, probably i had made a mistake somewhere in default.nix while i was packaging huggingface/diffusers.
Executing pythonImportsCheckPhase
Check whether the following modules can be imported: diffusers
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "<string>", line 1, in <lambda>
File "/nix/store/95cxzy2hpizr23343b8bskl4yacf4b3l-python3-3.10.11/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'diffusers'
I am attaching the default.nix code.
How i run the build: nix-build -A python310Packages.diffusers
inside of nixpkgs cloned repository/
Try disabling pythonImportsCheck and see if you can import the module after building.
Still can’t import diffusers
@collinarnett Hello, i used your repository, thank you. Maybe you know where is the problem?
I couldn’t make the tests work, but this worked for me
still needs some work to be submitted to nixpkgs, but hopefully this helps
{ lib
, buildPythonPackage
, fetchFromGitHub
, filelock
, huggingface-hub
, importlib-metadata
, numpy
, pillow
, regex
, requests
, accelerate
, black
# , compel
, datasets
, flax
# , hf-doc-builder
, isort
, jax
, jaxlib
, jinja2
# , k-diffusion
, librosa
# , note-seq
, parameterized
, protobuf
, pytest
, pytest-timeout
, pytest-xdist
, requests-mock
, ruff
, safetensors
, scipy
, sentencepiece
, tensorboard
, torch
, torchvision
, transformers
}:
buildPythonPackage rec {
pname = "diffusers";
version = "0.16.1";
format = "setuptools";
src = fetchFromGitHub {
owner = "huggingface";
repo = "diffusers";
rev = "v${version}";
hash = "sha256-/p+8w3YJPWj+XBAvPObIo8CcN2yjZekfV0AR3nkhUds=";
};
propagatedBuildInputs = [
filelock
huggingface-hub
importlib-metadata
numpy
pillow
regex
requests
];
passthru.optional-dependencies = {
dev = [
accelerate
black
# compel
datasets
flax
# hf-doc-builder
isort
jax
jaxlib
jinja2
# k-diffusion
librosa
# note-seq
parameterized
protobuf
pytest
pytest-timeout
pytest-xdist
requests-mock
ruff
safetensors
scipy
sentencepiece
tensorboard
torch
torchvision
transformers
];
docs = [
# hf-doc-builder
];
flax = [
flax
jax
jaxlib
];
quality = [
black
# hf-doc-builder
isort
ruff
];
test = [
# compel
datasets
jinja2
# k-diffusion
librosa
# note-seq
parameterized
pytest
pytest-timeout
pytest-xdist
requests-mock
safetensors
scipy
sentencepiece
torchvision
transformers
];
torch = [
accelerate
torch
];
training = [
accelerate
datasets
jinja2
protobuf
tensorboard
];
};
doCheck = false;
pythonImportsCheck = [ "diffusers" ];
meta = with lib; {
description = "State-of-the-art diffusion models for image and audio generation in PyTorch";
homepage = "https://github.com/huggingface/diffusers";
changelog = "https://github.com/huggingface/diffusers/releases/tag/${src.rev}";
license = licenses.asl20;
maintainers = with maintainers; [ ];
};
}
Not too sure what’s wrong with your file but I just updated the hash and the version of diffusers in my repo and it I get the import to succeed in a jupyter notebook; however I’m unsure if my flake check is actually executing pythonImportsCheck
I just updated the repo if you want to check it out. Thank you for your interest as well. I initially wanted to package this for nixpkgs but honestly the process seems pretty intimidating.