!fXpAvneDgyJuYMZSwO:nixos.org

Nix Data Science

284 Members
62 Servers

Load older messages


SenderMessageTime
16 Sep 2022
@sepiabrown:matrix.orgSuwon Park
In reply to @flxai:matrix.org
I am new to NixOS and wondering what's a good way to set up Jupyter. Are there opinions on JupyterWith or maybe some general recommendations?
Try using jupyterWith + poetry2nix with flake.nix! It's hard but fun!
18:33:55
@flxai:matrix.orgFelixsepiabrown: Thanks, this sounds like a good mix. Do you have configs lieing around somewhere?18:38:49
@sepiabrown:matrix.orgSuwon Park
In reply to @flxai:matrix.org
sepiabrown: Thanks, this sounds like a good mix. Do you have configs lieing around somewhere?

https://github.com/sepiabrown/jupyterWith_poetry2nix

If you are new to NixOS, the above solution may be hard!

If other advanced user could have a look at my code and have any comment for improvement, it would be appreciated!

19:22:32
@flxai:matrix.orgFelixThanks. I'll have a look the following days and try my best. Not that comfortable with Nix and its components yet19:28:06
18 Sep 2022
@FRidh:matrix.orgFRidh set a profile picture.17:20:55
24 Sep 2022
@peddie:matrix.orgpeddie joined the room.10:45:47
30 Sep 2022
@hinklejd:matrix.orghacobjinkleOn the topic of poetry, do you guys have any nice methods for getting an editable install using pure nix? I use a flake similar to above with poetry2nix, which works great for creating a derivation for a python package, but I then need to run poetry shell from inside a devshell (through direnv) to get editable install. Poetry shell creates a virtualenv in ~/.cache/pypoetry/virtualenvs, and the module versions installed there can sometimes differ from those in the devshell.00:43:25
@hinklejd:matrix.orghacobjinklepoetry lock works well of course, but for packaging in nix i'd like to do most testing with the versions specified in flake.lock rather than poetry.lock, if possible. For now i do active development in poetry shell, then run tests there and again in nix00:45:57
@codenode:matrix.orgcode node joined the room.01:55:14
@codenode:matrix.orgcode node set a profile picture.02:40:36
@genomematt:matrix.orgMatthew Wakefield set a profile picture.11:22:50
9 Oct 2022
@bigshaq9999:matrix.orgkunny joined the room.17:52:33
15 Oct 2022
@tinybronca:sibnsk.netunderpantsgnome! changed their display name from underpantsgnome to underpantsgnome!.00:33:53
16 Oct 2022
@jake_gillberg:matrix.orgjake_gillberg joined the room.22:30:10
22 Oct 2022
@happyalu:matrix.orghappyalu joined the room.17:10:29
23 Oct 2022
@waa:mozilla.orgwaa joined the room.21:31:34
24 Oct 2022
@waa:mozilla.orgwaa left the room.06:38:32
28 Oct 2022
@carlthome:matrix.orgcarlthome

I'm trying to get TensorFlow to work with a NVIDIA GPU on Ubuntu 22.04 LTS by a shell.nix but get caught up on missing library imports upon import tensorflow as tf.

I have the Ubuntu provided NVIDIA Display Driver installed and libnvidia-container works with GPU but I'm trying to nix:ify my life more and more without plunging into NixOS.

Does anyone have a working shell.nix for GPU-accelerated PyTorch/TensorFlow/JAX on a Debian-based distro?

13:33:57
29 Oct 2022
@seb:the-apothecary.clubTseb joined the room.06:12:40
31 Oct 2022
@tinybronca:sibnsk.netunderpantsgnome! changed their display name from underpantsgnome! to underpantsgnome.20:24:47
4 Nov 2022
@hinklejd:matrix.orghacobjinkle
In reply to@carlthome:matrix.org

I'm trying to get TensorFlow to work with a NVIDIA GPU on Ubuntu 22.04 LTS by a shell.nix but get caught up on missing library imports upon import tensorflow as tf.

I have the Ubuntu provided NVIDIA Display Driver installed and libnvidia-container works with GPU but I'm trying to nix:ify my life more and more without plunging into NixOS.

Does anyone have a working shell.nix for GPU-accelerated PyTorch/TensorFlow/JAX on a Debian-based distro?

{
  description = "PyTorch code for deep learning on chest X-rays (CXR)";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
    flake-utils.url = "github:numtide/flake-utils";
  };

  # See https://old.reddit.com/r/Python/comments/npu66t/reproducible_python_environment_with_nix_flake/
  outputs = { self, nixpkgs, flake-utils }: 
    flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
      let
        python = "python310";
        pkgs = (import nixpkgs {
          inherit system;
          config = {
            allowUnfree = true;
            cudaSupport = true;
          };
          overlays = [
          ];
        });
        # core pkgs are those required to run headless scripts
        corePythonPkgs = ps: with ps; [
          numpy
          pandas
          pytorchWithCuda
          scikit-learn
          scipy
          #torchinfo  # currently does not build on nix 22.05?? as of 2022-09-29
          torchvision
          tqdm
        ];
        corePythonEnv = pkgs.${python}.withPackages corePythonPkgs;
        jupyterPythonEnv = pkgs.${python}.withPackages (ps: with ps;
          ((corePythonPkgs ps) ++ [
            ipympl  # for %matplotlib widget
            jupyterlab
            matplotlib
            # not strictly for jupyter but still useful for development
            black
          ]));
      in rec {
        packages = {
          download = pkgs.stdenv.mkDerivation {
            name = "download";
            propagatedBuildInputs = with pkgs; [
              google-cloud-sdk
              ./download_mimic_cxr_jpg.sh
            ];
          };
        };
        apps = rec {
          default = jupyter;
          jupyter = {
            type = "app";
            # Note that this is not a full command line; do not include
            # arguments. If you would like to provide a command line, see the
            # "foo" example further down in this file
            program = "${jupyterPythonEnv}/bin/jupyter";
          };
          download = with pkgs; {
            type = "app";
            program = "${packages.download}/download_mimic_cxr_jpg.sh";
          };
        };
        devShell = pkgs.mkShell { buildInputs = with pkgs; [ jupyterPythonEnv ]; };
      });
}
13:27:35
@hinklejd:matrix.orghacobjinkleI run that on Ubuntu 20.04 workstation13:27:55
@hinklejd:matrix.orghacobjinklenote that you need to use nixGL13:28:09
@hinklejd:matrix.orghacobjinkle I don't reference nixGL in my flake.nix. Instead, I use nix run or nix develop, prefixed with nixGL 13:28:33
@hinklejd:matrix.orghacobjinkle nixgl can be built with a command like the following NIXPKGS_ALLOW_UNFREE=1 nix build --impure github:guibou/nixgl#nixGLNvidia -o nixgl 13:30:10
@hinklejd:matrix.orghacobjinkle in my case that results in a file nixgl/bin/nixGLNvidia-515.65.01 13:30:51
@hinklejd:matrix.orghacobjinklehave to rerun the command above whenever you update your nvidia driver13:31:13
@hinklejd:matrix.orghacobjinkle so for example. you can run nix develop then `$ nixGLNvidia python -c "import torch; print(torch.cuda.is_available())"
True
`
13:35:13
@hinklejd:matrix.orghacobjinkle * so for example. you can run nix develop then `$ nixGLNvidia python -c "import torch; print(torch.cuda.is_available())"
True`
13:35:19
@hinklejd:matrix.orghacobjinkle * so for example. you can run nix develop then
```
$ nixGLNvidia python -c "import torch; print(torch.cuda.is_available())"
True
```
13:35:33

Show newer messages


Back to Room ListRoom Version: 6