tweag / jupyenv

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

[Bug]: Accessing system command from kernels #528

Closed adfaure closed 11 months ago

adfaure commented 11 months ago

Current Behavior

Hello, I am trying to add system package to the kernel environment; such that I'll be able to use the executable from python.

For the moment, I can't access any program from the kernels. For instance, executing this from a cell:

subprocess.Popen(['ls', '-l'], shell=True)

gives the error

<Popen: returncode: None args: ['ls', '-l']>
-l: line 1: ls: No such file or directory

I hope my question makes sens.

Expected Behavior

I would like to have access, or define system dependencies of the running kernel.

Steps To Reproduce

git clone  git@gitlab.inria.fr:adfaure/ptask_tit_eval.git
nix develop
jupyter-lab

Then run, on a new cell a command, either with !ls -l or using subprocess.Popen.

OS

> nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.56, NixOS, 23.05 (Stoat), 23.05.20231011.bd1cde4`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.17.0`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`


### Version

You can check the flack.lock of the linked project in the reproduce section.

### Additional Context

_No response_

### Relevant log output

_No response_
GTrunSec commented 11 months ago

please see https://github.com/GTrunSec/jupyterWith/commit/33528df9bb1934b210534afa7d05cabbc3a0dad1

you should use the runtimePackages in your kernel.

  runtimePackages = [
      pkgs.coreutils
    ];

It is simply a use case that requires clarification rather than an issue. Therefore, it can be closed.