jupyenv icon indicating copy to clipboard operation
jupyenv copied to clipboard

[Bug]: "Python kernel with Poetry" example fails to build

Open emeinhardt opened this issue 1 year ago • 2 comments

Current Behavior

I have followed the documented example here and poetry fails when attempting to generate a lock file.

Expected Behavior

The tutorial example should work out of the box.

Steps To Reproduce

  1. Bootstrap the process via nix-shell -p poetry (cf 320)

mkdir my-project
cd my-project
nix flake init --template github:tweag/jupyenv
  1. Confirm nix run succeeds without issue.

  2. mkdir my-custom-python && cd my-custom-python

  3. <copy/paste the example 'pyproject.toml'>

  4. Attempt to lock the poetry file:

> poetry lock
Creating virtualenv jupyter-nix-kernel-ipython-oxr5bDaL-py3.10 in /home/emeinhardt/.cache/pypoetry/virtualenvs
Updating dependencies
Resolving dependencies... (0.1s)

Failed to create the collection: Failed to execute program org.freedesktop.secrets: No such file or directory.

OS

system: "x86_64-linux", multi-user?: yes, version: nix-env (Nix) 2.11.1, channels(emeinhardt): "", channels(root): "home-manager-22.11.tar.gz, nixos-22.11, nixos-hardware", nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Version

3ad2c9512c9efd586cf63adde454e734a8ce049c

Additional Context

The fix/hack in poetry/1917 works:

<continuing from 6 above> 6.

> export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
> poetry lock
Updating dependencies
Resolving dependencies... (5.2s)

Writing lock file
  1. Update kernels.nix:
{pkgs, ...}: {
  kernel.python.minimal = {
    enable = true;
  };
  kernel.python.python-with-numpy = {
    enable = true;
    projectDir = ./my-custom-python;
  };
}
  1. cd .. && nix run then also fails:
> cd ..
> nix run
error: builder for '/nix/store/73x3srfrgqd270dd52crvsc7jg8gkwv5-python3.10-pathspec-0.11.1.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 'flit_core'
       > 
       > 
       For full logs, run 'nix log /nix/store/73x3srfrgqd270dd52crvsc7jg8gkwv5-python3.10-pathspec-0.11.1.drv'.
error: 1 dependencies of derivation '/nix/store/1ji1h02vnxkknilx8w677b8ifd93igmd-python3-3.10.9-env.drv' failed to build
error: 1 dependencies of derivation '/nix/store/c6a8ms8g0cz7slci8j7lyyq885lz4b5x-wrapper-python3-3.10.9-env.drv' failed to build
error: 1 dependencies of derivation '/nix/store/0k9brpjwniy2zan9c6hyjzq5yd7z8g3z-python-python-with-numpy-jupyter-kernel.drv' failed to build
error: 1 dependencies of derivation '/nix/store/4cyv0pkv582pygipyswym5nicd2506xv-wrapper-chmod-python3-3.10.9-env.drv' failed to build

...but this is fixable by removing hatchling = "^1.3.1" from pyproject.toml.

Relevant log output

No response

emeinhardt avatar Apr 20 '23 20:04 emeinhardt

...but this is fixable by removing hatchling = "^1.3.1" from pyproject.toml.

This doesn't fix it for me, as it later complains about > ModuleNotFoundError: No module named 'hatchling'

supermarin avatar Jun 07 '23 19:06 supermarin

Removing 'hatchling' didn't help. Nix still demands 'flit_core'.

pachiras avatar Jul 03 '23 06:07 pachiras