Repository navigation
Description
Nixpkgs version
- Unstable (26.11)
Describe the bug
Hi, I'm fairly new to NixOS, so sorry if I'm missing something but at least some contribution 😅.
After updating my flake's nixpkgs, pre-commit stopped working for me. It fails while setting up the Python hook environments. When I dug into it, the problem seems to be virtualenv itself: just running virtualenv --version crashes with ModuleNotFoundError: No module named 'packaging'.
If I read things correctly, the update to 21.14.12 (#577206) is where this started. On PyPI, virtualenv 21.14.12 lists packaging>=26.3 as a required dependency, but the nixpkgs expression still only has distlib, filelock, platformdirs and python-discovery in dependencies. I think that packaging needs to be added there, but I'm not 100% sure that's the whole story seems to work for me.
Steps to reproduce
nix run github:NixOS/nixpkgs/177d0540942fb205af6993b1d5fa0b57799e09f8#python3Packages.virtualenv -- --version- It fails with a traceback ending in
ModuleNotFoundError: No module named 'packaging'.
Minimal reproducer
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/177d0540942fb205af6993b1d5fa0b57799e09f8";
outputs =
{ nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages.${system}.default = pkgs.python3Packages.virtualenv;
};
}
Command: `nix run . -- --version`Expected behaviour
virtualenv --version prints the version, and tools that use virtualenv (like pre-commit) can create their environments again.
Screenshots
No response
Relevant log output
File ".../python3.14-virtualenv-21.14.12/lib/python3.14/site-packages/virtualenv/seed/wheels/acquire.py", line 13, in <module>
from packaging.specifiers import InvalidSpecifier, Specifier
ModuleNotFoundError: No module named 'packaging'Additional context
For now I'm working around it with this overlay in my flake, and it works for me — pre-commit runs fine again:
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
(pyFinal: pyPrev: {
virtualenv = pyPrev.virtualenv.overridePythonAttrs (old: {
dependencies = old.dependencies ++ [ pyFinal.packaging ];
});
})
];I'm not sure whether that's the right way to fix it properly in nixpkgs, or why the build checks
didn't catch it. Maybe the import check only imports the top-level virtualenv module and never
reaches the part that needs packaging?
If it helps, I'm happy to open a PR that adds packaging to the dependencies. Just let me know if
you'd like me to, or if someone who knows this package better would rather handle it.
Disclosure: I used an LLM assistant (Claude Opus 5.5) to help track down the cause. I reproduced the failure myself and reviewed and edited the text before posting.
System metadata
🐳 SmokingCat dev env ready (Python 3.15.2, Node v26.13.0)
- system:
"x86_64-linux" - host os:
Linux 7.3.3, NixOS, 26.05 (Yarara), 26.05.20261108.ac588ef - multi-user?:
yes - sandbox:
yes - version:
nix-env (Nix) 2.34.9 - channels(root):
"home-manager-25.05.tar.gz, nixos-25.05, nixos-unstable" - nixpkgs:
/nix/store/7sa2x9c9566lfxkaxs36n3z4yayl5cy4-source
Notify maintainers
The package doesn't seem to have any maintainers listed, so I'm pinging the author of the version update, hope that's ok: @FliegendeWurst
Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)
I assert that this issue is relevant for Nixpkgs
- I assert that this is a bug and not a support request.
- I assert that this is not a duplicate of an existing issue.
- I assert that I have read the NixOS Code of Conduct and agree to abide by it.
- I assert that I have read the automation/AI policy and that this issue report complies with it.
Is this issue important to you?
Add a 👍 reaction to issues you find important.
Activity
FliegendeWurst commentedon Nov 13, 2026
Fix in #587178