DavHau / mach-nix

Create highly reproducible python environments
MIT License
861 stars 106 forks source link

Impossible to install jupyter: collisions #451

Open tobiasBora opened 2 years ago

tobiasBora commented 2 years ago

If I install:

let
  mach-nix = import (builtins.fetchGit {
    url = "https://github.com/DavHau/mach-nix";
    ref = "refs/tags/3.4.0";
  }) {};
in
mach-nix.mkPythonShell {
  requirements = ''
    numpy
    pyzx
    jupyter
  '';
}

I get an error involving collisions between jupyter and jupyter-core:

$ nix-shell
[...]
Executing pythonImportsCheckPhase
building '/nix/store/brd35m2xw09fqisqlnxkg2c8gigqwz32-python3-3.9.9-env.drv'...
error: collision between `/nix/store/hi7fmaw2mpd40n7k0iwbvb8jya5h68gx-python3.9-jupyter-core-4.9.1/lib/python3.9/site-packages/__pycache__/jupyter.cpython-39.pyc' and `/nix/store/n1ryapkfd3h8zddsa1iqf6icdjv8lbvb-python3.9-jupyter-1.0.0/lib/python3.9/site-packages/__pycache__/jupyter.cpython-39.pyc'
error: builder for '/nix/store/brd35m2xw09fqisqlnxkg2c8gigqwz32-python3-3.9.9-env.drv' failed with exit code 25;
       last 1 log lines:
       > error: collision between `/nix/store/hi7fmaw2mpd40n7k0iwbvb8jya5h68gx-python3.9-jupyter-core-4.9.1/lib/python3.9/site-packages/__pycache__/jupyter.cpython-39.pyc' and `/nix/store/n1ryapkfd3h8zddsa1iqf6icdjv8lbvb-python3.9-jupyter-1.0.0/lib/python3.9/site-packages/__pycache__/jupyter.cpython-39.pyc'
       For full logs, run 'nix log /nix/store/brd35m2xw09fqisqlnxkg2c8gigqwz32-python3-3.9.9-env.drv'.
error: 1 dependencies of derivation '/nix/store/7g5szv60g329j12m1fpn8sihw8qspnh8-python3-3.9.9-env.drv' failed to build
tobiasBora commented 2 years ago

Note that the ignoreCollisions seems to fail:

$ cat shell.nix 
let
  mach-nix = import (builtins.fetchGit {
    url = "https://github.com/DavHau/mach-nix";
    ref = "refs/tags/3.4.0";
  }) {};
in
mach-nix.mkPythonShell {
  requirements = ''
    numpy
    pyzx
    jupyter
  '';
  ignoreCollisions = true;
}

$ nix-shell
these 2 derivations will be built:
  /nix/store/brd35m2xw09fqisqlnxkg2c8gigqwz32-python3-3.9.9-env.drv
  /nix/store/slhnw3s3lmlbxzllbd8yvarn3s7ag6qm-python3-3.9.9-env.drv
building '/nix/store/brd35m2xw09fqisqlnxkg2c8gigqwz32-python3-3.9.9-env.drv'...
error: collision between `/nix/store/hi7fmaw2mpd40n7k0iwbvb8jya5h68gx-python3.9-jupyter-core-4.9.1/lib/python3.9/site-packages/__pycache__/jupyter.cpython-39.pyc' and `/nix/store/n1ryapkfd3h8zddsa1iqf6icdjv8lbvb-python3.9-jupyter-1.0.0/lib/python3.9/site-packages/__pycache__/jupyter.cpython-39.pyc'
error: builder for '/nix/store/brd35m2xw09fqisqlnxkg2c8gigqwz32-python3-3.9.9-env.drv' failed with exit code 25;
       last 1 log lines:
       > error: collision between `/nix/store/hi7fmaw2mpd40n7k0iwbvb8jya5h68gx-python3.9-jupyter-core-4.9.1/lib/python3.9/site-packages/__pycache__/jupyter.cpython-39.pyc' and `/nix/store/n1ryapkfd3h8zddsa1iqf6icdjv8lbvb-python3.9-jupyter-1.0.0/lib/python3.9/site-packages/__pycache__/jupyter.cpython-39.pyc'
       For full logs, run 'nix log /nix/store/brd35m2xw09fqisqlnxkg2c8gigqwz32-python3-3.9.9-env.drv'.
error: 1 dependencies of derivation '/nix/store/slhnw3s3lmlbxzllbd8yvarn3s7ag6qm-python3-3.9.9-env.drv' failed to build
charlesbaynham commented 2 years ago

I found this too - https://jupyter.org/install actually recommends installing via pip install notebook instead of pip install jupyter: using notebook fixed it for me.

TyberiusPrime commented 2 years ago

or tell mach-nix to remove the duplicate files:

  _."jupyter-core".postInstall = ''
              rm $out/lib/python*/site-packages/jupyter.py
              rm $out/lib/python*/site-packages/__pycache__/jupyter.cpython*.pyc
            '';
quinn-dougherty commented 2 years ago

same for jupyterlab