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

New project with flake hangs, using seemingly infinite memory #1332

Closed
paholg opened this issue Oct 4, 2023 · 2 comments
Closed

New project with flake hangs, using seemingly infinite memory #1332

paholg opened this issue Oct 4, 2023 · 2 comments

Comments

@paholg
Copy link

paholg commented Oct 4, 2023

Describe the issue

I created a new python project, and tried the flake template. Then, nix shell hangs and uses more and more memory until I kill it.

This is the only output produced:

evaluating derivation 'git+file:///home/paho/src/test#packages.x86_64-linux.default'

It is quite possible/likely that I am doing something wrong, and I would love pointers in the right direction. At this same time, this is not a great failure mode.

Additional context

To reproduce, run the following script on a system with flakes enabled:

#!/usr/bin/env bash

set -euxo pipefail

PROJECT_NAME="test"
mkdir "$PROJECT_NAME" && cd "$PROJECT_NAME" && git init
cat << PROJECT > pyproject.toml
[tool.poetry]
name = "test"
version = "0.0.1"
description = "foo"
authors = []

[tool.poetry.dependencies]
python = "^3.10"

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
PROJECT
git add pyproject.toml

nix-shell -p python310Packages.pipx --run \
  "pipx install --suffix=@master 'poetry@git+https://github.com/python-poetry/poetry.git@master' \
  && poetry@master lock"
git add poetry.lock

nix flake init -t github:nix-community/poetry2nix
git add flake.nix

# Hangs:
nix shell

flake.nix:

{
  description = "Application packaged using poetry2nix";

  inputs.flake-utils.url = "github:numtide/flake-utils";
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  inputs.poetry2nix = {
    url = "github:nix-community/poetry2nix";
    inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = { self, nixpkgs, flake-utils, poetry2nix }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        # see https://github.com/nix-community/poetry2nix/tree/master#api for more functions and examples.
        inherit (poetry2nix.legacyPackages.${system}) mkPoetryApplication;
        pkgs = nixpkgs.legacyPackages.${system};
      in
      {
        packages = {
          myapp = mkPoetryApplication { projectDir = self; };
          default = self.packages.${system}.myapp;
        };

        devShells.default = pkgs.mkShell {
          packages = [ poetry2nix.packages.${system}.poetry ];
        };
      });
}

pyproject.toml:

[tool.poetry]
name = "test"
version = "0.0.1"
description = "foo"
authors = []

[tool.poetry.dependencies]
python = "^3.10"

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

poetry.lock:

# This file is automatically @generated by Poetry 1.7.0.dev0 and should not be changed by hand.
package = []

[metadata]
lock-version = "2.0"
python-versions = "^3.10"
content-hash = "53f2eabc9c26446fbcc00d348c47878e118afc2054778c3c803a0a8028af27d9"
@paholg paholg changed the title New project with flake hangs, using seemingly infinite memroy New project with flake hangs, using seemingly infinite memory Oct 4, 2023
@sciyoshi
Copy link
Contributor

sciyoshi commented Oct 5, 2023

Please see the discussion here: #1291

@paholg
Copy link
Author

paholg commented Oct 5, 2023

Ah, thanks. Will close this as it seems to be the same issue.

@paholg paholg closed this as completed Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants