Failing to build from flake error mentions urllib3-2.2.3
Closed this issue · 4 comments
Describe the issue
nix on Ubuntu adding packages fails to build
Additional context
Trying to use the poetry2nix flake on ubuntu and when I add python packages it fails to build with this output. As I dont have a very deep understanding of nix I'm not sure if this is a poetry2nix problem
error: builder for '/nix/store/rasrdjkcchs2z2952h43zpkshbrfzf43-python3.12-urllib3-2.2.3.drv' failed with exit code 1;
last 10 log lines:
> full command: /nix/store/h3i0acpmr8mrjx07519xxmidv8mpax4y-python3-3.12.5/bin/python3.12 /nix/store/gam79wgc54sn8yyw2xkrqkf93v5lwaz1-python3.12-pip-24.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_wheel /build/tmp02fmg7w7
> cwd: /build/urllib3-2.2.3
> Preparing metadata (pyproject.toml) ... error
> error: metadata-generation-failed
>
> × Encountered error while generating package metadata.
> ╰─> See above for output.
>
> note: This is an issue with the package mentioned above, not pip.
> hint: See above for details.
For full logs, run 'nix log /nix/store/rasrdjkcchs2z2952h43zpkshbrfzf43-python3.12-urllib3-2.2.3.drv'.
error: 1 dependencies of derivation '/nix/store/xrxnygg38i2f0kix4fg5mk2ipk4mak0l-python3-3.12.5-env.drv' failed to build
heres my flake:
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.poetry2nix.url = "github:nix-community/poetry2nix";
outputs = { self, nixpkgs, poetry2nix }:
let
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
in
{
packages = forAllSystems (system: let
inherit (poetry2nix.lib.mkPoetry2Nix { pkgs = pkgs.${system}; }) mkPoetryApplication;
in {
default = mkPoetryApplication { projectDir = self; };
});
devShells = forAllSystems (system: let
inherit (poetry2nix.lib.mkPoetry2Nix { pkgs = pkgs.${system}; }) mkPoetryEnv;
in {
default = pkgs.${system}.mkShellNoCC {
packages = with pkgs.${system}; [
(mkPoetryEnv { projectDir = self; })
poetry
];
};
});
};
}
and here is my pyproject.toml
[tool.poetry]
name = "somethingsomething"
version = "0.1.0"
description = ""
authors = ["jeff"]
[tool.poetry.dependencies]
python = "^3.10"
requests = "^2.32.3"
[build-system]
requires = ["poetry-core", "setuptools>=61.0"]
build-backend = "poetry.core.masonry.api"
Other things I noticed are that if I remove the python libraries (requests in this case) nix develop
works. Also, adding packages and running poetry shell
works which leads me to believe this might be a poetry2nix problem. Any suggestions?
full log:
python3.12-urllib3> Sourcing python-remove-tests-dir-hook
python3.12-urllib3> Sourcing python-catch-conflicts-hook.sh
python3.12-urllib3> Sourcing python-remove-bin-bytecode-hook.sh
python3.12-urllib3> Sourcing pypa-install-hook
python3.12-urllib3> Using pypaInstallPhase
python3.12-urllib3> Sourcing python-imports-check-hook.sh
python3.12-urllib3> Using pythonImportsCheckPhase
python3.12-urllib3> Sourcing python-namespaces-hook
python3.12-urllib3> Sourcing pip-build-hook
python3.12-urllib3> Using pipBuildPhase
python3.12-urllib3> Using pipShellHook
python3.12-urllib3> Running phase: unpackPhase
python3.12-urllib3> unpacking source archive /nix/store/nhl7y3ark3kgqgwpk10dgbrmb05kv3ws-urllib3-2.2.3.tar.gz
python3.12-urllib3> source root is urllib3-2.2.3
python3.12-urllib3> setting SOURCE_DATE_EPOCH to timestamp 1726137421 of file urllib3-2.2.3/test/with_dummyserver/test_socketlevel.py
python3.12-urllib3> Running phase: patchPhase
python3.12-urllib3> Removing path dependencies
python3.12-urllib3> Finished removing path dependencies
python3.12-urllib3> Removing git dependencies
python3.12-urllib3> Finished removing git dependencies
python3.12-urllib3> Removing wheel-url dependencies
python3.12-urllib3> Finished removing wheel-url dependencies
python3.12-urllib3> Running phase: updateAutotoolsGnuConfigScriptsPhase
python3.12-urllib3> Running phase: configurePhase
python3.12-urllib3> no configure script, doing nothing
python3.12-urllib3> Running phase: buildPhase
python3.12-urllib3> Executing pipBuildPhase
python3.12-urllib3> Creating a wheel...
python3.12-urllib3> Processing /build/urllib3-2.2.3
python3.12-urllib3> Running command Preparing metadata (pyproject.toml)
python3.12-urllib3> Traceback (most recent call last):
python3.12-urllib3> File "/nix/store/gam79wgc54sn8yyw2xkrqkf93v5lwaz1-python3.12-pip-24.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
python3.12-urllib3> main()
python3.12-urllib3> File "/nix/store/gam79wgc54sn8yyw2xkrqkf93v5lwaz1-python3.12-pip-24.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
python3.12-urllib3> json_out['return_val'] = hook(**hook_input['kwargs'])
python3.12-urllib3> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
python3.12-urllib3> File "/nix/store/gam79wgc54sn8yyw2xkrqkf93v5lwaz1-python3.12-pip-24.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
python3.12-urllib3> whl_basename = backend.build_wheel(metadata_directory, config_settings)
python3.12-urllib3> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
python3.12-urllib3> File "/nix/store/293lfzrlrdzygf7p8z3h9df7i20njr6a-python3.12-hatchling-1.25.0/lib/python3.12/site-packages/hatchling/build.py", line 58, in build_wheel
python3.12-urllib3> return os.path.basename(next(builder.build(directory=wheel_directory, versions=['standard'])))
python3.12-urllib3> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
python3.12-urllib3> File "/nix/store/293lfzrlrdzygf7p8z3h9df7i20njr6a-python3.12-hatchling-1.25.0/lib/python3.12/site-packages/hatchling/builders/plugin/interface.py", line 116, in build
python3.12-urllib3> configured_build_hooks = self.get_build_hooks(directory)
python3.12-urllib3> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
python3.12-urllib3> File "/nix/store/293lfzrlrdzygf7p8z3h9df7i20njr6a-python3.12-hatchling-1.25.0/lib/python3.12/site-packages/hatchling/builders/plugin/interface.py", line 386, in get_build_hooks
python3.12-urllib3> raise UnknownPluginError(message)
python3.12-urllib3> hatchling.plugin.exceptions.UnknownPluginError: Unknown build hook: vcs
python3.12-urllib3> error: subprocess-exited-with-error
python3.12-urllib3> × Preparing metadata (pyproject.toml) did not run successfully.
python3.12-urllib3> │ exit code: 1
python3.12-urllib3> ╰─> See above for output.
python3.12-urllib3> note: This error originates from a subprocess, and is likely not a problem with pip.
python3.12-urllib3> full command: /nix/store/h3i0acpmr8mrjx07519xxmidv8mpax4y-python3-3.12.5/bin/python3.12 /nix/store/gam79wgc54sn8yyw2xkrqkf93v5lwaz1-python3.12-pip-24.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_wheel /build/tmp9lu0rhne
python3.12-urllib3> cwd: /build/urllib3-2.2.3
python3.12-urllib3> Preparing metadata (pyproject.toml) ... error
python3.12-urllib3> error: metadata-generation-failed
python3.12-urllib3> × Encountered error while generating package metadata.
python3.12-urllib3> ╰─> See above for output.
python3.12-urllib3> note: This is an issue with the package mentioned above, not pip.
python3.12-urllib3> hint: See above for details.
User error
How did you resolve this issue?
How did you resolve this issue?
Funny thing, I thought I found the problem but I actually didnt :( i Re-opened it. I tried with a new flake and still couldnt get a devshell
Steps to repro:
- create flake / pyproject with
nix flake init --template github:nix-community/poetry2nix
- use poetry with
nix develop .#poetry
- add package
poetry add requests
- exit poetry shell
- run
nix develop
I fixed with an override like this:
"urllib3" = super."urllib3".overridePythonAttrs (old: {
buildInputs = (old.buildInputs or [ ]) ++ [ super.hatch-vcs ];
});
If you have time you can upstream it.