Open MatrixManAtYrService opened 1 year ago
I think your are right, I can reproduce the issue. Do you have any more pointers to what's wrong? Is it mix of different python versions used by the tools and jupyter lab? Deeptools is a fairly complex build. I can try to upgrade the tool during the next day, maybe it helps?
Sorry, I didn't see this:
https://github.com/NixOS/nixpkgs/pull/251418
Really nice work, do you think this would fix the issue?
Pre-commit is a weird case. I thought I fixed it with https://github.com/NixOS/nixpkgs/pull/235123 by making it more self-contained, but that caused other problems which I thought I fixed with https://github.com/NixOS/nixpkgs/pull/251418 which adds special cases in which it it it less self contained.
I don't know deeptools well, but I somewhat doubt that the contents of https://github.com/NixOS/nixpkgs/pull/251418 are relevant to it (unless it somewhere has to call a program which is not expected to be packaged alongside it--that's what I broke).
My impression is that deeptools contains utilities that are run as standalone progams. That is, like so:
$ bamCoverage
And not imported like a module:
from deeptools import bamCoverage
So the ideal case is that the executables that end up on the user's PATH
are wrapper scripts which put the various python dependencies on the PATH
only for the process which is executing that particular... deep tool.
Since the deeptools derivation uses propagatedBuildInputs
, the paths to these dependencies are being passed along to jupyter-lab as if it needs them. As it turns out, it depends on something else, and the versions from deeptools are breaking it. I think the fix should be as simple as deleting the propagatedBuildInputs in a build step, just like I have done in https://github.com/NixOS/nixpkgs/pull/235123. That way buildPythonApplication
includes them in the wrapper script that it creates (i.e. they become available at runtime when the wrapper gets called), but they don't propagate so far that they end up interfering with jupyter-lab.
Perhaps this is obvious, but when I first encountered this kind of problem I benefitted from looking at the wrapper script which the problematic package generates:
❯ nix-shell -p deeptools
these 2 paths will be fetched (1.33 MiB download, 8.61 MiB unpacked):
/nix/store/40dlqj7irwh0iihnb5ykcs16950qrxg0-deepTools-3.5.1
/nix/store/8pzf49yq6v0ki772fhpgvrvn053gmbpz-bash-interactive-5.2-p15
copying path '/nix/store/8pzf49yq6v0ki772fhpgvrvn053gmbpz-bash-interactive-5.2-p15' from 'https://cache.nixos.org'...
copying path '/nix/store/40dlqj7irwh0iihnb5ykcs16950qrxg0-deepTools-3.5.1' from 'https://cache.nixos.org'...
[nix-shell:~/src/nixpkgs]$ cat $(which bamCoverage)
#! /nix/store/3ln9yvs9pg78qvabh89y0a4m1hqzyl1h-bash-5.2-p15/bin/bash -e
PATH=${PATH:+':'$PATH':'}
PATH=${PATH/':''/nix/store/fabx2mv2akxbci8274l05p1fm9va68qc-python3.10-fonttools-4.38.0/bin'':'/':'}
PATH='/nix/store/fabx2mv2akxbci8274l05p1fm9va68qc-python3.10-fonttools-4.38.0/bin'$PATH
PATH=${PATH#':'}
PATH=${PATH%':'}
export PATH
PATH=${PATH:+':'$PATH':'}
PATH=${PATH/':''/nix/store/77jkj30xrd566wpdj66rz21g8zz4nvxs-python3.10-cython-0.29.36/bin'':'/':'}
PATH='/nix/store/77jkj30xrd566wpdj66rz21g8zz4nvxs-python3.10-cython-0.29.36/bin'$PATH
PATH=${PATH#':'}
PATH=${PATH%':'}
export PATH
PATH=${PATH:+':'$PATH':'}
PATH=${PATH/':''/nix/store/4y06nybvndzax9flil8pipbbqdgd707w-python3.10-pbr-5.11.1/bin'':'/':'}
PATH='/nix/store/4y06nybvndzax9flil8pipbbqdgd707w-python3.10-pbr-5.11.1/bin'$PATH
PATH=${PATH#':'}
PATH=${PATH%':'}
export PATH
PATH=${PATH:+':'$PATH':'}
PATH=${PATH/':''/nix/store/j5wpnynag3sbhl4fkx6lw7dw4gysg3cj-python3.10-charset-normalizer-3.0.1/bin'':'/':'}
PATH='/nix/store/j5wpnynag3sbhl4fkx6lw7dw4gysg3cj-python3.10-charset-normalizer-3.0.1/bin'$PATH
PATH=${PATH#':'}
PATH=${PATH%':'}
export PATH
PATH=${PATH:+':'$PATH':'}
PATH=${PATH/':''/nix/store/2ddkqq4y94dbh41hdj9b5w5mz86hqqz3-python3.10-docutils-0.19/bin'':'/':'}
PATH='/nix/store/2ddkqq4y94dbh41hdj9b5w5mz86hqqz3-python3.10-docutils-0.19/bin'$PATH
PATH=${PATH#':'}
PATH=${PATH%':'}
export PATH
PATH=${PATH:+':'$PATH':'}
PATH=${PATH/':''/nix/store/2ikwq24yd21i516hz2k6c6xg7vmshgm2-python3.10-pygments-2.15.1/bin'':'/':'}
PATH='/nix/store/2ikwq24yd21i516hz2k6c6xg7vmshgm2-python3.10-pygments-2.15.1/bin'$PATH
PATH=${PATH#':'}
PATH=${PATH%':'}
export PATH
PATH=${PATH:+':'$PATH':'}
PATH=${PATH/':''/nix/store/yxzrgs9h0pf51g2n9h139z71y9xvbfvm-python3.10-sphinx-5.3.0/bin'':'/':'}
PATH='/nix/store/yxzrgs9h0pf51g2n9h139z71y9xvbfvm-python3.10-sphinx-5.3.0/bin'$PATH
PATH=${PATH#':'}
PATH=${PATH%':'}
export PATH
PATH=${PATH:+':'$PATH':'}
PATH=${PATH/':''/nix/store/nk5z9mjm2xxmg2yvkgv7ap4dxrfjsndw-python3.10-babel-2.12.1/bin'':'/':'}
PATH='/nix/store/nk5z9mjm2xxmg2yvkgv7ap4dxrfjsndw-python3.10-babel-2.12.1/bin'$PATH
PATH=${PATH#':'}
PATH=${PATH%':'}
export PATH
PATH=${PATH:+':'$PATH':'}
PATH=${PATH/':''/nix/store/x80hp101kwdc8f6218lh1nbx5k1119kf-python3.10-numpy-1.25.1/bin'':'/':'}
PATH='/nix/store/x80hp101kwdc8f6218lh1nbx5k1119kf-python3.10-numpy-1.25.1/bin'$PATH
PATH=${PATH#':'}
PATH=${PATH%':'}
export PATH
PATH=${PATH:+':'$PATH':'}
PATH=${PATH/':''/nix/store/40dlqj7irwh0iihnb5ykcs16950qrxg0-deepTools-3.5.1/bin'':'/':'}
PATH='/nix/store/40dlqj7irwh0iihnb5ykcs16950qrxg0-deepTools-3.5.1/bin'$PATH
PATH=${PATH#':'}
PATH=${PATH%':'}
export PATH
PATH=${PATH:+':'$PATH':'}
PATH=${PATH/':''/nix/store/aa3nnkfyif67k6861vd77g4cm4rgbqh8-python3-3.10.12/bin'':'/':'}
PATH='/nix/store/aa3nnkfyif67k6861vd77g4cm4rgbqh8-python3-3.10.12/bin'$PATH
PATH=${PATH#':'}
PATH=${PATH%':'}
export PATH
export PYTHONNOUSERSITE='true'
exec -a "$0" "/nix/store/40dlqj7irwh0iihnb5ykcs16950qrxg0-deepTools-3.5.1/bin/.bamCoverage-wrapped" "$@"
So there they are, the packages which bamCoverage
expects to have on its path. And here they are, also in the devShell:
So the solution I'm suggesting is to change the derivation such that these dependencies stay in the wrapper script, but are not in the devShell. If you don't get around to it, I'll try to revisit this in a few weeks.
Also, be aware that I'm not blocked by this. I have submitted that homework assignment and moved on. I just reported the issue because it felt like the helpful thing to do. It's possible that the real bug here is that I'm trying to use a devShell as a way to hack dependencies into a jupyter notebook in the first place. I've been meaning to study https://github.com/tweag/jupyenv, which likely provides a smarter way to do this.
I just wanted to point this out because if you decided that this wasn't a bug after all, I wouldn't argue with you.
Describe the bug
Jupyter Lab kernels fail to start, but only when deeptools is installed.
Steps To Reproduce
Here'a flake.nix
Steps to reproduce the behavior:
nix develop
jupyter lab
hi
Expected behavior
Jupyter Lab should work whether or not deeptools is installed
Logs
The jupyter labs logs do not exactly contain a smoking gun:
Additional context
I think that this problem is similar to the one solved here: https://github.com/NixOS/nixpkgs/pull/235123
Here is a workaround:
I can't be sure that
$out/nix-support/propagated-build-inputs
didn't break something, but the tool I need,bamCoverage
seems to work.Notify maintainers
@scalavision
Metadata