tweag / jupyenv

Declarative and reproducible Jupyter environments - powered by Nix
https://jupyenv.io/
MIT License
627 stars 131 forks source link

[Bug]: logo64.png: No such file or directory #527

Open lenianiva opened 9 months ago

lenianiva commented 9 months ago

Current Behavior

I created a python kernel using the instructions here, and it gave this error:

error (ignored): error: end of string reached
error:
       … while calling the 'getAttr' builtin

         at /builtin/derivation.nix:19:19: (source not available)

       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: getting status of '/nix/store/g1xm5mkbhv8r135zsr8zdmarmffmrzby-source/logo64.png': No such file or directory

Expected Behavior

Jupyter would start running

Steps To Reproduce

  1. Create the following files: flake.nix from nix flake init --template github:tweag/jupyenv. Modify kernels.nix:
    {pkgs, ...}: {
    kernel.python.minimal = {
    enable = true;
    projectDir = ./.;
    };
    }
  2. pyproject.toml from https://github.com/tweag/jupyenv/blob/main/docs/documentation/how-to.md
    
    [tool.poetry]
    name = "jupyter-nix-kernel-ipython"
    version = "0.1.0"
    description = ""
    authors = []

[tool.poetry.dependencies] python = "^3.9" numpy = "^1.23.0" ipykernel = "^6.15.0"

[tool.poetry.dev-dependencies]

build systems for dependencies

hatchling = "^1.3.1"

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

3. Execute `poetry lock`
4. `nix run`

### OS

```shell
this path will be fetched (0.00 MiB download, 0.00 MiB unpacked):
  /nix/store/fyvbj5mvrvdnvhbx6hc977wsgl33pk3i-nix-info
copying path '/nix/store/fyvbj5mvrvdnvhbx6hc977wsgl33pk3i-nix-info' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 6.5.5-arch1-1, Arch Linux, noversion, rolling`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.17.0`
 - nixpkgs: `/home/aniva/.nix-defexpr/channels/nixpkgs`

Version

https://github.com/tweag/jupyenv/commit/97f76f92fa14814e955a4f6847eaa4198525a19e

The previous version does not have the issue with logo64.png, but it still has issue with flit_core

https://github.com/tweag/jupyenv/commit/3ad2c9512c9efd586cf63adde454e734a8ce049c

Additional Context

touch logo64.png creates a different problem:

error: builder for '/nix/store/bzarby67w4hwgxjql9s4dakm474wpf9x-python3.10-editables-0.5.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/bzarby67w4hwgxjql9s4dakm474wpf9x-python3.10-editables-0.5.drv'.
error: 1 dependencies of derivation '/nix/store/9bd3yw7bym0bzlwsk28nn3l6acrsvvyc-python3-3.10.9-env.drv' failed to build
error: 1 dependencies of derivation '/nix/store/igb3jmn1n124yrhgx4bqmr2s0j5cdy3d-wrapper-python3-3.10.9-env.drv' failed to build
error: 1 dependencies of derivation '/nix/store/znb4mmyffp209il1lzgsrp9pb0ky29f5-python-minimal-jupyter-kernel.drv' failed to build
error: 1 dependencies of derivation '/nix/store/xm6wwyqvjvvskcl2pa2jvi0fazlmcgyg-wrapper-chmod-python3-3.10.9-env.drv' failed to build

Relevant log output

No response

lenianiva commented 9 months ago

The solution about flit_core can be found here: https://github.com/tweag/jupyenv/blob/97f76f92fa14814e955a4f6847eaa4198525a19e/docs/documentation/how-to.md?plain=1#L169

GTrunSec commented 9 months ago

The solution about flit_core can be found here:

if you don't know how to solve that issue via overrides.nix with poetry2nix. Please try my PR branch to get the native nixpkgs support for the kernels.

GTrunSec commented 9 months ago

solved -> https://github.com/tweag/jupyenv/pull/524/commits/ba06739aa0e52e52bf1de20c24c7fb06c4d0cdab

trevex commented 8 months ago

Thanks @GTrunSec,

I ran into the same issue and tried using your branch, e.g.

inputs.jupyenv.url = "github:GTrunSec/jupyterWith/chore";

Unfortunately this results in another error on nix run:

trace: warning: Unknown rpds-py version: '0.10.6'. Please update getCargoHash.
error: getting status of '/nix/store/g7lkqdx4wdz77p5lbsbx038956jhg813-source/logo-64x64.png': No such file or directory

The warning I attribute to https://discourse.nixos.org/t/poetry2nix-mismatch-cryptography-sha256-but-unable-to-modify/33897

The error happens as nix is looking for the logo in the kernel's projectDir. As a workaround I copied the logo over, which then makes nix run still error, but most likely due to an issue in poetry2nix as outlined in the above Discourse:

trace: warning: Unknown rpds-py version: '0.10.6'. Please update getCargoHash.
error: hash mismatch in fixed-output derivation '/nix/store/hcl9xsg13zccln3q1cknclvbvl4ckdry-rpds-py-0.10.6-vendor.tar.gz.drv':
         specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
            got:    sha256-8bXCTrZErdE7JhuoudU/4dDndCMwvjy2a+2IY0DWDzg=

I saw there is a new mkPoetryKernel function. Should this be used in the future instead for a Poetry-based Python kernel?

GTrunSec commented 8 months ago

@trevex for the logo error is a bug for sure(will be fixed tomorrow) second, if you don't know how to override the package with poetry2nix like https://github.com/GTrunSec/dataflow2nix/blob/main/nix/prefect/packages/overrides.nix#L23 just use the native python env: https://github.com/tweag/jupyenv/pull/524/commits/a56c43dbb0ccd18dd0f984eef890af745d62ea11#diff-459c8fd464b8b23e4b2f8ebb00690d572772b9a755aa7a5cce5d4574079edfa1R4

GTrunSec commented 8 months ago

@trevex fixed https://github.com/tweag/jupyenv/pull/524/commits/e8a9d572a7bad1dd63efa6dbcc7cff0387065206