vaibhavsagar / notebooks

Jupyter notebooks
BSD 3-Clause "New" or "Revised" License
58 stars 7 forks source link

`$(nix-build)/bin/jupyter-notebook` fails #4

Closed idontgetoutmuch closed 2 years ago

idontgetoutmuch commented 2 years ago
Wandle% cd continuations/
cd continuations/
Wandle% $(nix-build)/bin/jupyter-notebook
$(nix-build)/bin/jupyter-notebook
error: Package ‘python3.9-pyopenssl-22.0.0’ in /nix/store/apz5b280q5nrjm5lvbmcr3zkw6n59amf-source/pkgs/development/python-modules/pyopenssl/default.nix:73 is marked as broken, refusing to evaluate.

       a) To temporarily allow broken packages, you can use an environment variable
          for a single invocation of the nix tools.

            $ export NIXPKGS_ALLOW_BROKEN=1

        Note: For `nix shell`, `nix build`, `nix develop` or any other Nix 2.4+
        (Flake) command, `--impure` must be passed in order to read this
        environment variable.

       b) For `nixos-rebuild` you can set
         { nixpkgs.config.allowBroken = true; }
       in configuration.nix to override this.

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
         { allowBroken = true; }
       to ~/.config/nixpkgs/config.nix.
(use '--show-trace' to show detailed location information)
zsh: no such file or directory: /bin/jupyter-notebook
idontgetoutmuch commented 2 years ago

https://github.com/NixOS/nixpkgs/issues/174457

idontgetoutmuch commented 2 years ago

I tried this

{
  "ihaskell": {
    "owner": "IHaskell",
    "repo": "IHaskell",
    "branch": "master",
    "rev": "0c5cde127e0471333abce52b397cd80484d6f1f5",
    "sha256": "1qv16fp6d438wf6kqsri2iby186rhgvwk6b49mjxh4z4knclxg8r"
  },
  "nixpkgs": {
    "owner": "NixOS",
    "repo": "nixpkgs",
    "branch": "master",
    "rev": "66def2957e4e0d26e7f691bef0945c9f3b73c313",
    "sha256": "sha256:172icihh7s1caph108d5ybhk71ai3s64fnmcmxaksp7lk4ac3l4b"
  }
}

but still the same problem. Is there a way of saying you want the local nixpkgs?

vaibhavsagar commented 2 years ago

~This is why I never track master for nixpkgs in this repo :smile:~ Nevermind, I thought this was caused by the nixpkgs revision you were using. You can edit default.nix to use your local <nixpkgs> as follows:

diff --git a/continuations/default.nix b/continuations/default.nix
index 1dc1089..f07aa10 100644
--- a/continuations/default.nix
+++ b/continuations/default.nix
@@ -1,7 +1,7 @@
 let
   pkgs = import ../pkgs.nix;
 in import "${pkgs.ihaskell}/release.nix" {
-  nixpkgs = import pkgs.nixpkgs {};
+  nixpkgs = import <nixpkgs> {};
   compiler = "ghc902";
   packages = self: with self; [];
 }
vaibhavsagar commented 2 years ago

I should also point out that I can't reproduce the original error you are seeing on the latest master (https://github.com/vaibhavsagar/notebooks/commit/50e6d1d893963e52e6f27aa8f80b2db58918b1d4), is this perhaps an OS-specific issue?

Edit: ah, it does seem to be specific to aarch64-darwin. Another workaround would be

diff --git a/continuations/default.nix b/continuations/default.nix
index 1dc1089..fada5fc 100644
--- a/continuations/default.nix
+++ b/continuations/default.nix
@@ -1,7 +1,7 @@
 let
   pkgs = import ../pkgs.nix;
 in import "${pkgs.ihaskell}/release.nix" {
-  nixpkgs = import pkgs.nixpkgs {};
+  nixpkgs = import pkgs.nixpkgs { config.allowBroken = true; };
   compiler = "ghc902";
   packages = self: with self; [];
 }
idontgetoutmuch commented 2 years ago

Hi @vaibhavsagar thanks for the quick response - I think the package really is broken

zsh: segmentation fault  nix-shell -I nixpkgs=/Users/dom/nixpkgs
idontgetoutmuch commented 2 years ago
Wandle% pwd
pwd
/Users/dom/nixpkgs
Wandle% git log --oneline -1
git log --oneline -1
15ad87dfd2d (HEAD -> foo, origin/master, origin/HEAD, idontgetoutmuch/foo) Merge pull request #176204 from r-ryantm/auto-update/python3.10-yte
Wandle% nix-shell -I nixpkgs=/Users/dom/nixpkgs -p "pkgs.python39.withPackages(ps: with ps; [pyopenssl])"
<kgs -p "pkgs.python39.withPackages(ps: with ps; [pyopenssl])"

[nix-shell:~/monad-bayes/vaibhavsagar/notebooks]$ python
python
Python 3.9.13 (main, May 29 2022, 02:18:12) 
[Clang 11.1.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import OpenSSL as pssl
import OpenSSL as pssl
>>> print(pssl.__version__)
print(pssl.__version__)
22.0.0

My nix fu is not good enough to use my local copy of nixpkgs but I did this

Wandle% cat versions.json 
cat versions.json 
{
  "ihaskell": {
    "owner": "IHaskell",
    "repo": "IHaskell",
    "branch": "master",
    "rev": "0c5cde127e0471333abce52b397cd80484d6f1f5",
    "sha256": "1qv16fp6d438wf6kqsri2iby186rhgvwk6b49mjxh4z4knclxg8r"
  },
  "nixpkgs": {
    "owner": "idontgetoutmuch",
    "repo": "nixpkgs",
    "branch": "foo",
    "rev": "15ad87dfd2d017cf36507ff86aaae413d8a9a311",
    "sha256": "sha256:10lvjhch7x9bv8hh2xmi2wilx7xyvz52cryaad2j1bh2gklf3fd8"
  }
}

So I think I am using the same hash for your nix as I am to invoke openssl at the command line. So now I am baffled. How can openssl be broken but also not broken? Maybe if I use openssl for something real it will give a segfault?

idontgetoutmuch commented 2 years ago

I forgot to say I had to do set export NIXPKGS_ALLOW_BROKEN=1 so it really is marked as broken but does build and at least gives me its version.

BTW I am on macOS M1 and I am sure this is the problem but my nix knowledge and macOS knowledge are not good enough to fix it.

vaibhavsagar commented 2 years ago

Hmm, it's possible the segfault is a red herring. Unfortunately I don't have access to an M1 Mac so can't really be of more help here.

idontgetoutmuch commented 2 years ago

I tried on an old Mac and got this https://github.com/NixOS/nixpkgs/issues/176525 (pyopenssl installs but jupyterlab_server does not and does not build even if I allow broken) so it's not just an M1 problem. My guess is it the latest version of macOS. But that has given me an idea: I have a really old MacBook and will try on that.

idontgetoutmuch commented 2 years ago

It seems to be a version of macOS problem so I am going to close this although I am no nearer to being able to use notebooks :-(