18 Dec 2023 |
| phaebz changed their profile picture. | 23:21:32 |
20 Dec 2023 |
| @username:yatrix.org joined the room. | 10:30:58 |
23 Dec 2023 |
| raitobezarius changed their display name from raitobezarius to raitobezarius (DECT 2128). | 22:22:37 |
27 Dec 2023 |
| mjlbach left the room. | 01:53:48 |
| Charlotte 🦝 (it/its) changed their profile picture. | 09:14:53 |
30 Dec 2023 |
| benoitdr joined the room. | 09:37:52 |
benoitdr | Hi all, here is my shell.nix for jupyter lab environment (I'm not a flake user so I keep it as shell.nix for the moment). I'm now trying to add ctransformers library but the build fails miserability (see the log, problem to locate setup.py as I understand, although I see it at the project root). Would anyone have an idea ?
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/archive/04220ed6763637e5899980f98d5c8424b1079353.tar.gz";
pkgs = import nixpkgs { config = {}; overlays = []; };
ctransformers = pkgs.python310.pkgs.buildPythonPackage rec {
pname = "ctransformers";
version = "0.2.27";
format = "pyproject";
src = pkgs.python310.pkgs.fetchPypi {
inherit pname version;
sha256 = "25653d4be8a5ed4e2d3756544c1e9881bf95404be5371c3ed506a256c28663d5";
};
doCheck = false;
nativeBuildInputs = [
pkgs.python310Packages.setuptools
pkgs.python310Packages.scikit-build
pkgs.python310Packages.ninja
pkgs.python310Packages.cmake
pkgs.python310Packages.huggingface-hub
pkgs.python310Packages.py-cpuinfo
pkgs.python310Packages.huggingface-hub
pkgs.python310Packages.py-cpuinfo
];
};
in
pkgs.mkShell {
packages = with pkgs; [
(python310.withPackages (ps: with ps; [
numpy
pandas
matplotlib
scipy
jupyterlab
ipympl
jupyterlab-git
ctransformers
]))
];
shellHook = ''
jupyter lab
exit
'';
}
and here is the error message :
-- Build files have been written to: /build/ctransformers-0.2.27/build
cmake: enabled parallel building
cmake: enabled parallel installing
building
Executing pypaBuildPhase
Creating a wheel...
ERROR Source /build/ctransformers-0.2.27/build does not appear to be a Python project: no pyproject.toml or setup.py
error: builder for '/nix/store/cwk0kjniclqcskv3i5gxfw5nihld0md9-python3.10-ctransformers-0.2.27.drv' failed with exit code 1;
last 10 log lines:
> CMAKE_POLICY_DEFAULT_CMP0025
>
>
> -- Build files have been written to: /build/ctransformers-0.2.27/build
> cmake: enabled parallel building
> cmake: enabled parallel installing
> building
> Executing pypaBuildPhase
> Creating a wheel...
> ERROR Source /build/ctransformers-0.2.27/build does not appear to be a Python project: no pyproject.toml or setup.py
For full logs, run 'nix log /nix/store/cwk0kjniclqcskv3i5gxfw5nihld0md9-python3.10-ctransformers-0.2.27.drv'.
error: 1 dependencies of derivation '/nix/store/r07h95i2csyx80f0lsf05v7i4jciqxg2-python3-3.10.13-env.drv' failed to build
| 09:45:01 |
trexd | In reply to @benoitdr:matrix.org
Hi all, here is my shell.nix for jupyter lab environment (I'm not a flake user so I keep it as shell.nix for the moment). I'm now trying to add ctransformers library but the build fails miserability (see the log, problem to locate setup.py as I understand, although I see it at the project root). Would anyone have an idea ?
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/archive/04220ed6763637e5899980f98d5c8424b1079353.tar.gz";
pkgs = import nixpkgs { config = {}; overlays = []; };
ctransformers = pkgs.python310.pkgs.buildPythonPackage rec {
pname = "ctransformers";
version = "0.2.27";
format = "pyproject";
src = pkgs.python310.pkgs.fetchPypi {
inherit pname version;
sha256 = "25653d4be8a5ed4e2d3756544c1e9881bf95404be5371c3ed506a256c28663d5";
};
doCheck = false;
nativeBuildInputs = [
pkgs.python310Packages.setuptools
pkgs.python310Packages.scikit-build
pkgs.python310Packages.ninja
pkgs.python310Packages.cmake
pkgs.python310Packages.huggingface-hub
pkgs.python310Packages.py-cpuinfo
pkgs.python310Packages.huggingface-hub
pkgs.python310Packages.py-cpuinfo
];
};
in
pkgs.mkShell {
packages = with pkgs; [
(python310.withPackages (ps: with ps; [
numpy
pandas
matplotlib
scipy
jupyterlab
ipympl
jupyterlab-git
ctransformers
]))
];
shellHook = ''
jupyter lab
exit
'';
}
and here is the error message :
-- Build files have been written to: /build/ctransformers-0.2.27/build
cmake: enabled parallel building
cmake: enabled parallel installing
building
Executing pypaBuildPhase
Creating a wheel...
ERROR Source /build/ctransformers-0.2.27/build does not appear to be a Python project: no pyproject.toml or setup.py
error: builder for '/nix/store/cwk0kjniclqcskv3i5gxfw5nihld0md9-python3.10-ctransformers-0.2.27.drv' failed with exit code 1;
last 10 log lines:
> CMAKE_POLICY_DEFAULT_CMP0025
>
>
> -- Build files have been written to: /build/ctransformers-0.2.27/build
> cmake: enabled parallel building
> cmake: enabled parallel installing
> building
> Executing pypaBuildPhase
> Creating a wheel...
> ERROR Source /build/ctransformers-0.2.27/build does not appear to be a Python project: no pyproject.toml or setup.py
For full logs, run 'nix log /nix/store/cwk0kjniclqcskv3i5gxfw5nihld0md9-python3.10-ctransformers-0.2.27.drv'.
error: 1 dependencies of derivation '/nix/store/r07h95i2csyx80f0lsf05v7i4jciqxg2-python3-3.10.13-env.drv' failed to build
Looks like ctransformers is failing to build. I have a working implementation of ctransformers here https://github.com/collinarnett/LLM-VM/blob/nix/nix/packages/ctransformers/default.nix which is adapted from https://github.com/jpetrucciani/nix/blob/fab25e6f22a76439754bc04d80a5d70d45a76ec1/mods/python/ai/bindings.nix#L462 | 17:00:48 |
| raitobezarius changed their display name from raitobezarius (DECT 2128) to raitobezarius. | 19:53:16 |
31 Dec 2023 |
benoitdr | Redacted or Malformed Event | 08:30:54 |
trexd | In reply to @benoitdr:matrix.org Thanks, dontUseCmakeConfigure = true was the missing piece Yeah protip, if you're looking for AI packages, use github search and do language:Nix PACKAGE_NAME buildPythonPackage and there's a good chance someone has already packaged it. That saves me so much time :D | 17:04:35 |
2 Jan 2024 |
benoitdr | In reply to @trexd:matrix.org Yeah protip, if you're looking for AI packages, use github search and do language:Nix PACKAGE_NAME buildPythonPackage and there's a good chance someone has already packaged it. That saves me so much time :D Great, thanks ! | 08:35:38 |
| 1H0 joined the room. | 11:33:37 |
3 Jan 2024 |
benoitdr | Still a question : I have successfully packaged ctransformers based on the information above, but it cannot see my GPU. If I would pip install it, I would use the cuda option (pip install ctransfomers[cuda]). Is there a way to pass the same option to buildPythonPackage ? | 13:01:55 |
benoitdr | In reply to @benoitdr:matrix.org Still a question : I have successfully packaged ctransformers based on the information above, but it cannot see my GPU. If I would pip install it, I would use the cuda option (pip install ctransfomers[cuda]). Is there a way to pass the same option to buildPythonPackage ? (partially) answering to myslef, looking at setup.py, I can see that the cuda option corresponds to 2 extra packages :
"cuda": [
"nvidia-cuda-runtime-cu12",
"nvidia-cublas-cu12",
],
| 14:18:44 |
SomeoneSerge (UTC+U[-12,12]) | (casual reminder that these are poetry2nix-generated wrappers for the pypi wheels, expect them to break) | 14:33:54 |
SomeoneSerge (UTC+U[-12,12]) | In reply to @benoitdr:matrix.org Still a question : I have successfully packaged ctransformers based on the information above, but it cannot see my GPU. If I would pip install it, I would use the cuda option (pip install ctransfomers[cuda]). Is there a way to pass the same option to buildPythonPackage ? Pass the respective flags to cmake | 14:34:10 |
SomeoneSerge (UTC+U[-12,12]) | * (casual reminder that these are poetry2nix-generated wrappers for the pypi wheels, expect them to break)
EDIT: aj this is from setup.py, nvm | 14:34:33 |
benoitdr | Need more info ... indeed these 2 pkgs from setup.py are nvidia proprietary and only distributed as wheels on pypi. So what is the way out (if any) ? I have already tried to include python310Packages.pycuda, cudaPackages.libcublas, cudaPackages.cuda_cudart, cudaPackages.cudatoolkit , also passing allowUnfree = true; cudaSupport = true; to nixpkgs config, without success. I'm feeling a bit stuck here ... | 14:43:55 |
SomeoneSerge (UTC+U[-12,12]) | You need to pass this flag during the ctransformers build: https://github.com/marella/ctransformers/blob/ed02cf4b9322435972ff3566fd4832806338ca3d/CMakeLists.txt#L6 | 14:45:55 |
SomeoneSerge (UTC+U[-12,12]) |
cudaPackages.cudatoolkit
You can remove this one | 14:46:22 |
SomeoneSerge (UTC+U[-12,12]) |
python310Packages.pycuda
I don't see pycuda in ctrasnformers' dependencies? | 14:47:01 |
SomeoneSerge (UTC+U[-12,12]) | In reply to @ss:someonex.net You need to pass this flag during the ctransformers build: https://github.com/marella/ctransformers/blob/ed02cf4b9322435972ff3566fd4832806338ca3d/CMakeLists.txt#L6 Their setup.py introduces an ad hoc environment variable for that: https://github.com/marella/ctransformers/blob/ed02cf4b9322435972ff3566fd4832806338ca3d/setup.py#L10C41-L10C42 | 14:50:11 |
SomeoneSerge (UTC+U[-12,12]) | It would've been better if they weren't wrapping/hiding cmake from the user but at least there's a variable | 14:50:37 |
SomeoneSerge (UTC+U[-12,12]) | So you can set something like env.CT_CUBLAS = "ON" | 14:51:22 |
benoitdr | Yep, env.CT_CUBLAS = "ON"; was the trick. Still I need cudatoolkit in propagatedBuildInputs, nothing more. Thanks a lot ! | 15:58:26 |
4 Jan 2024 |
SomeoneSerge (UTC+U[-12,12]) |
Still I need cudatoolkit in propagatedBuildInputs
cudaPackages.cudatoolkit is being deprecated, you do not need it; cf. nixpkgs' torch or opencv4 derivations for examples | 04:47:57 |
SomeoneSerge (UTC+U[-12,12]) | Also there's no need to propagate it | 04:48:08 |
| thetootler joined the room. | 06:25:27 |
benoitdr | Strange ... It doesn't work without it on my side | 19:56:48 |