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

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

Closed
emeinhardt opened this issue Apr 20, 2023 · 3 comments
Closed

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

emeinhardt opened this issue Apr 20, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@emeinhardt
Copy link

emeinhardt commented Apr 20, 2023

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

3ad2c95

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 emeinhardt added the bug Something isn't working label Apr 20, 2023
@supermarin
Copy link

...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'

@pachiras
Copy link

pachiras commented Jul 3, 2023

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

@GTrunSec
Copy link
Collaborator

closes by #524

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants