Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixpkgs#poetry is broken at nixpkgs-unstable #193657

Closed
farcaller opened this issue Sep 30, 2022 · 17 comments
Closed

nixpkgs#poetry is broken at nixpkgs-unstable #193657

farcaller opened this issue Sep 30, 2022 · 17 comments
Labels
0.kind: build failure A package fails to build

Comments

@farcaller
Copy link
Contributor

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix shell nixpkgs#poetry

Build log

error: builder for '/nix/store/4s93ccs152sgmrwmgr4wp7py1m73iirf-python3.10-toml-0.10.2.drv' failed with exit code 2;
       last 10 log lines:
       >   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
       >   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
       >   File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
       >   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
       >   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 'setuptools'
       >
       >
       For full logs, run 'nix log /nix/store/4s93ccs152sgmrwmgr4wp7py1m73iirf-python3.10-toml-0.10.2.drv'.
error: 1 dependencies of derivation '/nix/store/cfv33w2xc7lxrv3zjbcv75nni1a6phvr-python3.10-keyring-22.3.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/bvzl52l1maa7yw70cwql3kxnhzf6id57-python3.10-poetry-1.1.14.drv' failed to build

Additional context

nix log /nix/store/4s93ccs152sgmrwmgr4wp7py1m73iirf-python3.10-toml-0.10.2.drv
Sourcing python-remove-tests-dir-hook
Sourcing python-catch-conflicts-hook.sh
Sourcing python-remove-bin-bytecode-hook.sh
Sourcing pip-build-hook
Using pipBuildPhase
Using pipShellHook
Sourcing pip-install-hook
Using pipInstallPhase
Sourcing python-imports-check-hook.sh
Using pythonImportsCheckPhase
Sourcing python-namespaces-hook
Sourcing python-catch-conflicts-hook.sh
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/pnxyi9iyn540ycwckwz4bqc8q2cv44ks-toml-0.10.2.tar.gz
source root is toml-0.10.2
setting SOURCE_DATE_EPOCH to timestamp 1604194634 of file toml-0.10.2/setup.cfg
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
no configure script, doing nothing
@nix { "action": "setPhase", "phase": "buildPhase" }
building
Executing pipBuildPhase
Creating a wheel...
WARNING: The directory '/homeless-shelter/.cache/pip' or its parent directory is not owned or is not writable by the cu>
Processing /build/toml-0.10.2
  Running command Preparing metadata (pyproject.toml)
  Preparing metadata (pyproject.toml) ... done
ERROR: Exception:
Traceback (most recent call last):
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/cl>
    status = run_func(*args)
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/cl>
    return func(self, options, args)
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/co>
    requirement_set = resolver.resolve(reqs, check_supported_wheels=True)
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/re>
    collected = self.factory.collect_root_requirements(root_reqs)
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/re>
    req = self._make_requirement_from_install_req(
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/re>
    cand = self._make_candidate_from_link(
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/re>
    self._link_candidate_cache[link] = LinkCandidate(
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/re>
    super().__init__(
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/re>
    self.dist = self._prepare()
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/re>
    dist = self._prepare_distribution()
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/re>
    return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/op>
    return self._prepare_linked_requirement(req, parallel_builds)
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/op>
    dist = _get_prepared_distribution(
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/op>
    abstract_dist.prepare_distribution_metadata(
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/di>
    self.req.prepare_metadata()
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/re>
    self.metadata_directory = generate_metadata(
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/op>
    distinfo_dir = backend.prepare_metadata_for_build_wheel(metadata_dir)
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/ut>
    return super().prepare_metadata_for_build_wheel(
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_vendor/pep5>
    return self._call_hook('prepare_metadata_for_build_wheel', {
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_vendor/pep5>
    raise BackendUnavailable(data.get('traceback', ''))
pip._vendor.pep517.wrappers.BackendUnavailable: Traceback (most recent call last):
  File "/nix/store/d59d879qx54id3mpmryvx7h8fnndlgna-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_vendor/pep5>
    obj = import_module(mod_path)
  File "/nix/store/wyhbl43ycqn43d08v5fqj1j6ynf7nz73-python3-3.10.7/lib/python3.10/importlib/__init__.py", line 126, in >
    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 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  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 'setuptools'

Notify maintainers

@Twey

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.57.1-microsoft-standard-WSL2, NixOS, 22.11 (Raccoon)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.11.0`
 - channels(root): `"nixos-21.11.337975.eabc3821918"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@farcaller farcaller added the 0.kind: build failure A package fails to build label Sep 30, 2022
@farcaller
Copy link
Contributor Author

Apparently that's due to poetry being broken.

@farcaller farcaller closed this as not planned Won't fix, can't repro, duplicate, stale Sep 30, 2022
@ilmari-lauhakangas
Copy link
Contributor

Apparently that's due to poetry being broken.

So is there a regression in upstream poetry? Any issue I can follow? Thanks for the info.

@farcaller
Copy link
Contributor Author

I think this is the one: nix-community/poetry2nix#736

@cpcloud
Copy link
Contributor

cpcloud commented Oct 2, 2022

In theory poetry2nix should have no effect on nixpkgs#poetry.

@cpcloud
Copy link
Contributor

cpcloud commented Oct 2, 2022

Seems related to this poetry issue: python-poetry/poetry#4242

@cpcloud
Copy link
Contributor

cpcloud commented Oct 2, 2022

I can't reproduce this issue with only nix shell 'nixpkgs#poetry'.

@farcaller What specific commit/channel/etc does nixpkgs refer to in your expression?

@cpcloud
Copy link
Contributor

cpcloud commented Oct 2, 2022

I am able to reproduce this on master (in a checkout) using:

nix build -f . poetry

@cpcloud
Copy link
Contributor

cpcloud commented Oct 2, 2022

Should this be reopened? It seems like a fairly significant issue.

@cpcloud
Copy link
Contributor

cpcloud commented Oct 2, 2022

It seems like a huge number of packages including a bunch that have an enormous number of dependents need to have setuptools added to nativeBuildInputs. I just added setuptools to pyparsing.nativeBuildInputs and that allowed pyparsing to build successfully while also rebuilding things like cmake, ninja, and one of the llvm versions.

@cpcloud
Copy link
Contributor

cpcloud commented Oct 2, 2022

Hm, okay maybe not. I was getting a different build path

@cpcloud
Copy link
Contributor

cpcloud commented Oct 2, 2022

Related: #194084

@NobbZ
Copy link
Contributor

NobbZ commented Oct 5, 2022

I do not think it is related to poetry2nix not a specific upstream issue, it is git bisectable1 to a certain commit to nixpkgs that does not touch poetry at all (13bb0f4):

13bb0f49f7afe8296452d70e7782ac1d67b064da is the first bad commit
commit 13bb0f49f7afe8296452d70e7782ac1d67b064da
Author: Frederik Rietdijk <fridh@fridh.nl>
Date:   Tue Aug 9 18:48:56 2022 +0200

    buildPython*: wrap setuptools in hook for catching conflicts

    By default buildPython* runs a hook for detecting conflicting packages.
    This hook needs pkg_resources which is part of setuptools.

    Before this commit, setuptools was simply added to the build. This meant
    that when setuptools was forgotten to be added to the build, the build
    and installation would still succeed because of this package from the
    hook. During runtime (and cross-compilation) one would notice the
    missing package.

 pkgs/development/interpreters/python/hooks/default.nix                 | 3 +--
 .../interpreters/python/hooks/python-catch-conflicts-hook.sh           | 2 +-
 pkgs/development/interpreters/python/mk-python-derivation.nix          | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)
  1. Which took long enough, had to rebuild llvm and rust a couple of times…

@cpcloud
Copy link
Contributor

cpcloud commented Oct 5, 2022

Yep!

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/python-packages-are-not-building-modulenotfounderror-no-module-named-setuptools/22232/2

@FRidh
Copy link
Member

FRidh commented Oct 5, 2022

As can be read in the commit message, with 13bb0f4 setuptools will not always be included in every package. That meant many expressions had to be fixed.

The poetry attribute, which is also used by poetry2nix, uses poetry2nix to build itself. poetry2nix uses the Nixpkgs buildPythonPackage. Because setuptools is not included everywhere, this meant basically all poetry2nix projects in Nixpkgs got broken as well.

In nix-community/poetry2nix#736 a good solution is proposed. A quick work-around would be to always include setuptools in buildPythonPackage used by poetry2nix.

@yajo
Copy link
Contributor

yajo commented Oct 12, 2022

This is fixed already, not sure in which commit.

@ehllie
Copy link
Contributor

ehllie commented Oct 12, 2022

Fixed by #195316

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: build failure A package fails to build
Projects
None yet
Development

No branches or pull requests

8 participants