!fXpAvneDgyJuYMZSwO:nixos.org

Nix Data Science

214 Members
52 Servers

Load older messages


SenderMessageTime
6 Jan 2024
@ss:someonex.netSomeoneSerge (utc+3)
In reply to @benoitdr:matrix.org

Here is my shell.nix file :

let
  nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/archive/04220ed6763637e5899980f98d5c8424b1079353.tar.gz";
  pkgs = import nixpkgs { config = { allowUnfree = true; }; overlays = []; };
  ctransformers = pkgs.python310.pkgs.buildPythonPackage rec {
      pname = "ctransformers";
      version = "0.2.27";
      format = "setuptools";
      src = pkgs.python310.pkgs.fetchPypi {
        inherit pname version;
        sha256 = "25653d4be8a5ed4e2d3756544c1e9881bf95404be5371c3ed506a256c28663d5";
      };
      doCheck = false;
      dontUseCmakeConfigure = true;
      nativeBuildInputs = with pkgs; [
        python310Packages.setuptools
        python310Packages.scikit-build
        python310Packages.ninja
        python310Packages.cmake
      ];
      propagatedBuildInputs = with pkgs; [
        python310Packages.huggingface-hub
        python310Packages.py-cpuinfo
        cudaPackages.cudatoolkit
      ];
      env.CT_CUBLAS = "ON";
    };
in
  pkgs.mkShell {
    packages = with pkgs; [
      (python310.withPackages (ps: with ps; [
        ctransformers
      ]))
    ];
  }

Without cudatoolkit, at compile time, ctransformers complaints that cublas is not found, and at runtime, ctransformers cannot use the GPU.
As far as I undertstand, it seems a bit logical to me. How would ctransfomers find the cuda libraries without cudatoolkit ?

By you llisting individual cuda libraries and nvcc as inputs, cf torch/default.nix and opencv/4.nix for the examples

The documentation needs to be clarified about this...

14:40:09
7 Jan 2024
@benoitdr:matrix.orgbenoitdr

Indeed a bit of documentation would help ;-)
Looking at cudatoolkit sources, I can see that it's importing many many things I don't need, so I would be happy to get rid of it.
Unfortunately, if I replace it by cuda_nvcc, cuda_cudart and libcublas, ctransformers doesn't build anymore.

-- Using CUDA architectures: 52;61;70
-- Unable to find cuda_runtime.h in "/nix/store/p8058x6fpdlw7hy72qsqn41qhllqncgm-cuda_nvcc-11.8.89/include" for CUDAToolkit_INCLUDE_DIR.
-- Unable to find cublas_v2.h in either "" or "/nix/math_libs/include"
-- Could NOT find CUDAToolkit (missing: CUDAToolkit_INCLUDE_DIR) (found version "11.8.89")
CMake Warning at CMakeLists.txt:163 (message):
  cuBLAS not found

Looking at CMakeLists.txt :

if (CT_CUBLAS)
    find_package(CUDAToolkit)

So it seems there is a problem with the CUDAToolkit_INCLUDE_DIR env variable.
Not sure it's related, but looking at https://cmake.org/cmake/help/latest/module/FindCUDAToolkit.html, that function is setting a CUDAToolkit_INCLUDE_DIRS (with extra S)

10:27:28
@ss:someonex.netSomeoneSerge (utc+3)Is cuda_nvcc in nativeBuildInputs?10:29:56
@benoitdr:matrix.orgbenoitdryes10:34:09
@ss:someonex.netSomeoneSerge (utc+3)
In reply to @benoitdr:matrix.org

Indeed a bit of documentation would help ;-)
Looking at cudatoolkit sources, I can see that it's importing many many things I don't need, so I would be happy to get rid of it.
Unfortunately, if I replace it by cuda_nvcc, cuda_cudart and libcublas, ctransformers doesn't build anymore.

-- Using CUDA architectures: 52;61;70
-- Unable to find cuda_runtime.h in "/nix/store/p8058x6fpdlw7hy72qsqn41qhllqncgm-cuda_nvcc-11.8.89/include" for CUDAToolkit_INCLUDE_DIR.
-- Unable to find cublas_v2.h in either "" or "/nix/math_libs/include"
-- Could NOT find CUDAToolkit (missing: CUDAToolkit_INCLUDE_DIR) (found version "11.8.89")
CMake Warning at CMakeLists.txt:163 (message):
  cuBLAS not found

Looking at CMakeLists.txt :

if (CT_CUBLAS)
    find_package(CUDAToolkit)

So it seems there is a problem with the CUDAToolkit_INCLUDE_DIR env variable.
Not sure it's related, but looking at https://cmake.org/cmake/help/latest/module/FindCUDAToolkit.html, that function is setting a CUDAToolkit_INCLUDE_DIRS (with extra S)

Ah, this is because they wrap cmake into the setup.py
12:58:41
@ss:someonex.netSomeoneSerge (utc+3) Got to pass the cmakeFlags to cmake 12:59:09
@ss:someonex.netSomeoneSerge (utc+3)
In reply to @benoitdr:matrix.org

Indeed a bit of documentation would help ;-)
Looking at cudatoolkit sources, I can see that it's importing many many things I don't need, so I would be happy to get rid of it.
Unfortunately, if I replace it by cuda_nvcc, cuda_cudart and libcublas, ctransformers doesn't build anymore.

-- Using CUDA architectures: 52;61;70
-- Unable to find cuda_runtime.h in "/nix/store/p8058x6fpdlw7hy72qsqn41qhllqncgm-cuda_nvcc-11.8.89/include" for CUDAToolkit_INCLUDE_DIR.
-- Unable to find cublas_v2.h in either "" or "/nix/math_libs/include"
-- Could NOT find CUDAToolkit (missing: CUDAToolkit_INCLUDE_DIR) (found version "11.8.89")
CMake Warning at CMakeLists.txt:163 (message):
  cuBLAS not found

Looking at CMakeLists.txt :

if (CT_CUBLAS)
    find_package(CUDAToolkit)

So it seems there is a problem with the CUDAToolkit_INCLUDE_DIR env variable.
Not sure it's related, but looking at https://cmake.org/cmake/help/latest/module/FindCUDAToolkit.html, that function is setting a CUDAToolkit_INCLUDE_DIRS (with extra S)

https://gist.github.com/SomeoneSerge/3c2fc29c79dfc4803c5cb277688566a7
13:10:20
8 Jan 2024
@ss:someonex.netSomeoneSerge (utc+3) changed their display name from SomeoneSerge (UTC+2) to SomeoneSerge (hash-versioned python modules when).04:50:11
@benoitdr:matrix.orgbenoitdrOK I see, thanks for the explanations and the example09:45:12
13 Jan 2024
@gambrose:matrix.orggambrose joined the room.00:41:46
@gambrose:matrix.orggambroseHi all. New here and am looking for some help. I am trying to get a persistent jupyterhub/lab up and running on nixos. I have made progress, but stuck on two items. First, is it possible in the approach I am using to add jupyterlab extensions declaratively? I saw that its possible if I build a shell to use, but I would rather not take that approach. Second, while I got a pything env up and running with some basic data science packages to try out, I can't get an R to work. Console won't connect to the kernel, even after multiple attempts. Pasting my code below, if anyone has pointers who may have tried this. Thanks! 04:58:28
@gambrose:matrix.orggambrose

{ config, lib, pkgs, ... }:

{

services.jupyterhub = {

enable = true;
jupyterhubEnv = pkgs.python311.withPackages (p: with p; [
    jupyterhub
    jupyterhub-systemdspawner
    pip
    ipython
    jupyter
    notebook
    ipykernel
  ]);
jupyterlabEnv = pkgs.python311.withPackages (p: with p; [
    jupyterhub
    jupyterlab
    pip
    ipython
    jupyter
    notebook
    ipykernel
  ]);
kernels = {
  python311 = let
    env = (pkgs.python311.withPackages (python311Packages: with python311Packages; [
      ipykernel
      pandas
      scikit-learn
      numpy
      seaborn
      matplotlib
      scipy
    ]));
  in {
    displayName = "Python 3 for ML";
    argv = [
      "${env.interpreter}"
      "-m"
      "ipykernel_launcher"
      "-f"
      "{connection_file}"
    ];
    language = "python";
    logo32 = "${env.sitePackages}/ipykernel/resources/logo-32x32.png";
    logo64 = "${env.sitePackages}/ipykernel/resources/logo-64x64.png";
  };
  R = let
    env = (pkgs.rWrapper.override {
      packages = with pkgs.rPackages; [
        IRkernel
        tidyverse
        caret
        randomForest
        tidymodels
        purrr
        shiny
        data_table
        jsonlite
      ];
    });
  in {
    displayName = "R for ML";
    argv = [
      "/nix/store/pqynpqccbr41zz3pg844qiq2h87mxhwx-R-4.3.2-wrapper/bin/R"
      "--slave"
      "-e"
      "IRkernel::main()"
      "--args"
      "{connection_file}"
    ];
    language = "R";
    logo32 = "${env.sitePackages}/IRKernel/resources/logo-32x32.png";
    logo64 = "${env.sitePackages}/IRkernel/resources/logo-64x64.png";
  };
};

};

}

04:58:33
@gambrose:matrix.orggambrose * Hi all. New here and am looking for some help. I am trying to get a persistent jupyterhub/lab up and running on nixos. I have made progress, but stuck on two items. First, is it possible in the approach I am using to add jupyterlab extensions declaratively? I saw that its possible if I build a shell to use, but I would rather not take that approach. Second, while I got a python env up and running with some basic data science packages to try out, but I can't get an R to work. Console won't connect to the kernel, even after multiple attempts, including finding and using the full path to the R bin. Pasting my code below, if anyone has pointers who may have tried this. Thanks! 05:00:17
@felipeggmarcelino:matrix.orgfelipeggmarcelino joined the room.19:53:14
14 Jan 2024
@benoitdr:matrix.orgbenoitdr
In reply to @gambrose:matrix.org
Hi all. New here and am looking for some help. I am trying to get a persistent jupyterhub/lab up and running on nixos. I have made progress, but stuck on two items. First, is it possible in the approach I am using to add jupyterlab extensions declaratively? I saw that its possible if I build a shell to use, but I would rather not take that approach. Second, while I got a python env up and running with some basic data science packages to try out, but I can't get an R to work. Console won't connect to the kernel, even after multiple attempts, including finding and using the full path to the R bin. Pasting my code below, if anyone has pointers who may have tried this. Thanks!
For the extensions, can't you just add them like other packages ? See jupyterlab-widgets, jupyterlab-git, jupyterlab-lsp, ...
09:29:23
15 Jan 2024
@gambrose:matrix.orggambrose
In reply to @benoitdr:matrix.org
For the extensions, can't you just add them like other packages ? See jupyterlab-widgets, jupyterlab-git, jupyterlab-lsp, ...
Yes, that works for some extensions that have official packages (like jupyterlab-lsp), but not all extensions have packages, but I can probably do a derivation to create them from their github repos. But related issue. Jupyterlab-git needs regular git installed, which it obvioulsy is on the base system, but the jupyterhub/lab environment for some reason can't see git. I must need to load it into the hub/lab environment. They are built like this:
02:49:40
@gambrose:matrix.orggambrose
In reply to @benoitdr:matrix.org
For the extensions, can't you just add them like other packages ? See jupyterlab-widgets, jupyterlab-git, jupyterlab-lsp, ...
*

Yes, that works for some extensions that have official packages (like jupyterlab-lsp), but not all extensions have packages, but I can probably do a derivation to create them from their github repos. But related issue. Jupyterlab-git needs regular git installed, which it obvioulsy is on the base system, but the jupyterhub/lab environment for some reason can't see git. I must need to load it into the hub/lab environment. They are built with this:

jupyterhubEnv = pkgs.python311.withPackages (p: with p; [
    jupyterhub
    jupyterhub-systemdspawner
    ...
02:50:18
@gambrose:matrix.orggambrose *

Yes, that works for some extensions that have official packages (like jupyterlab-lsp), but not all extensions have packages, but I can probably do a derivation to create them from their github repos. But related issue. Jupyterlab-git needs regular git installed, which it obvioulsy is on the base system, but the jupyterhub/lab environment for some reason can't see git. I must need to load it into the hub/lab environment. They are built with this:

jupyterhubEnv = pkgs.python311.withPackages (p: with p; [
    jupyterhub
    jupyterhub-systemdspawner
    ...

Is it possible to load non python311pacakges into this enviornment. I tried a few different ways, but couldn't get it to work. Trying to load the regular git nixos package.
Thanks!

02:52:00
@gambrose:matrix.orggambrose * Yes, that works for some extensions that have official packages (like jupyterlab-lsp), but not all extensions have packages, but I can probably do a derivation to create them from their github repos. But related issue. Jupyterlab-git needs regular git installed, which it obvioulsy is on the base system, but the jupyterhub/lab environment for some reason can't see git. I must need to load it into the hub/lab environment. They are built like this: 03:26:01
@gambrose:matrix.orggambrose *

Yes, that works for some extensions that have official packages (like jupyterlab-lsp), but not all extensions have packages, but I can probably do a derivation to create them from their github repos. But related issue. Jupyterlab-git needs regular git installed, which it obvioulsy is on the base system, but the jupyterhub/lab environment for some reason can't see git. I must need to load it into the hub/lab environment. They are built like this:

jupyterhubEnv = pkgs.python311.withPackages (p: with p; [
    jupyterhub
    jupyterhub-systemdspawner
    pip
    ...

It appears you can only load python packages into the underlying environment. Is there a way to load non python packages, such as git?
Thanks.

03:28:00
@gambrose:matrix.orggambrose *

Yes, that works for some extensions that have official packages (like jupyterlab-lsp), but not all extensions have packages, but I can probably do a derivation to create them from their github repos. But related issue. Jupyterlab-git needs regular git installed, which it obviously is on the base system, but the jupyterhub/lab environment for some reason can't see git. I must need to load it into the hub/lab environment. They are built like this:

jupyterhubEnv = pkgs.python311.withPackages (p: with p; [
    jupyterhub
    jupyterhub-systemdspawner
    pip
    ...

It appears you can only load python packages into the underlying environment. Is there a way to load non python packages, such as git?

06:03:30
@data_thrall:matrix.orgdata_thrall joined the room.07:12:52
16 Jan 2024
@benoitdr:matrix.orgbenoitdr

I'm not sure how you are working. Personally, I use nix-shell to package all the development environment (including python modules and non-python packages). Here is an example for jupyter lab :

let
  nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/archive/04220ed6763637e5899980f98d5c8424b1079353.tar.gz";
  pkgs = import nixpkgs { config = {}; overlays = []; };
in
  pkgs.mkShell {
    packages = with pkgs; [
      (python310.withPackages (ps: with ps; [
        numpy
        pandas
        matplotlib
        scipy
        jupyterlab
        ipympl
        jupyterlab-git
      ]))
      git
    ];

  shellHook = ''
    jupyter lab
  '';
  }

Note that unless you use nix-shell --pure, you don't need to add git if it is alrready present at OS level, although it's probability better to add it anyway for portability

12:34:26
17 Jan 2024
@andredornas:matrix.organdredornas joined the room.13:51:45
18 Jan 2024
@fizihcyst:matrix.orgfizihcystHi, is anyone here using julia? I see that recently a pr was merged to nixpkgs to build julia.withPackages similar to python. This is fine for simple scripts, but does anyone have recommendations for using nix with a julia Project.toml/Manifest.toml? Maybe something similar to poetry2nix? I see two julia2nix repos, but had trouble getting them to work. A working example julia project+flake would be helpful.17:08:43
22 Jan 2024
@gkapfham:matrix.orgGregory M. Kapfhammer joined the room.16:59:42
@gkapfham:matrix.orgGregory M. KapfhammerHello, does anyone have a good example of how to get Quarto to work on NixOS? I created this site using Quarto on Arch Linux: https://github.com/gkapfham/www.gregorykapfhammer.com This configuration allows me to use Poetry to manage the project's dependencies. When I am in the poetry shell I can use quarto and it finds all of the project's dependencies in the virtualenv when I run it on Arch Linux. However, when I use NixOS the quarto program installed through nix packages does not seem to pass along the dependencies in the virtual environment. I am glad to share more details. With that said, does anyone have a quick idea as to what I should try next? Thanks!18:27:19
@phiadaarr:matrix.orgphiadaarr joined the room.21:19:10
23 Jan 2024
@bcdarwin:matrix.orgbcdarwin joined the room.22:54:56
25 Jan 2024
@trexd:matrix.org@trexd:matrix.orgWhat are people's thoughts around putting data in the nix store? Only small stuff? Large datasets too? Only in specific situations?16:25:09

Show newer messages


Back to Room ListRoom Version: 6