tweag / blog-resources

Extra resources for Tweag's blog posts.
https://www.tweag.io/blog
38 stars 11 forks source link

`nix-shell` in `monad-bayes-series` fails on darwin #12

Open jO-Osko opened 4 years ago

jO-Osko commented 4 years ago

I am having a problem setting up the environment in monad-bayes blog post series (https://github.com/tweag/blog-resources/blob/master/monad-bayes-series/shell.nix).

Describe the bug nix-shell fails to install. The test session for ipython starts produces errors and fails.

...
Successfully installed ipykernel-5.1.2
/private/tmp/nix-build-python3.7-ipykernel-5.1.2.drv-0/ipykernel-5.1.2
Finished executing pipInstallPhase
post-installation fixup
strip is /nix/store/aj65kacim8zjwb63bnxmfcjda0730dm7-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/9bl1f5gxfp460l0w0kpsinp0b15s663v-python3.7-ipykernel-5.1.2/lib
patching script interpreter paths in /nix/store/9bl1f5gxfp460l0w0kpsinp0b15s663v-python3.7-ipykernel-5.1.2
running install tests
============================= test session starts ==============================
platform darwin -- Python 3.7.5, pytest-5.2.1, py-1.8.0, pluggy-0.13.0
rootdir: /private/tmp/nix-build-python3.7-ipykernel-5.1.2.drv-0/ipykernel-5.1.2
collected 106 items / 5 deselected / 101 selected                              

ipykernel/inprocess/tests/test_kernel.py .s..                            [  3%]
ipykernel/inprocess/tests/test_kernelmanager.py ....                     [  7%]
ipykernel/tests/test_async.py EEEE                                       [ 11%]
ipykernel/tests/test_connect.py .....                                    [ 16%]
ipykernel/tests/test_embed_kernel.py ...                                 [ 19%]
ipykernel/tests/test_eventloop.py E                                      [ 20%]
ipykernel/tests/test_heartbeat.py ...                                    [ 23%]
ipykernel/tests/test_io.py .                                             [ 24%]
ipykernel/tests/test_jsonutil.py .....                                   [ 29%]

Sometimes it hangs after test_jsonutil.py, after a fresh install of nix, it produces kernel died before replying.

To Reproduce run nix-shell --option sandbox false.

Environment

curiousleo commented 4 years ago

@jO-Osko thanks for the report. Unfortunately I don't have a macOS machine, and I have no idea how to even investigate this further.

Just to clarify: I'm assuming you tried to load the environment defined in https://github.com/tweag/blog-resources/blob/master/monad-bayes-series/shell.nix?

I hope someone more knowledgeable than me can help out here.

jO-Osko commented 4 years ago

Yes, it is the environment from monad-bayes series. (I have also updated the description).

curiousleo commented 4 years ago

Hey @jO-Osko, it looks like the pinned version of jupyterWith used in the monad-bayes-series environment is quite old. Newer versions have been tested against macOS in CI.

I've updated the revision in #13. I can't guarantee that it will work because I can't test it on macOS myself. If you like, you can give the update-jupyterwith branch (from #13) a spin!

jO-Osko commented 4 years ago

Hi Thanks for the response Unfortunately, I got another error with conflicting dependencies:

Conflicting Dependencies:
JupyterLab              Extension      Package
>=2.1.0 <2.2.0          >=1.0.0 <2.0.0 @jupyterlab/application
>=2.1.0 <2.2.0          >=1.0.0 <2.0.0 @jupyterlab/apputils
>=2.1.0 <2.2.0          >=1.0.0 <2.0.0 @jupyterlab/notebook
>=5.1.0 <5.2.0          >=4.0.0 <5.0.0 @jupyterlab/services

An error occured.
ValueError: No version of jupyterlab-ihaskell could be found that is compatible with the current version of JupyterLab.

Conflicting Dependencies:
JupyterLab              Extension      Package
>=2.1.0 <2.2.0          >=1.0.0 <2.0.0 @jupyterlab/application
>=2.1.0 <2.2.0          >=1.0.0 <2.0.0 @jupyterlab/apputils
>=2.1.0 <2.2.0          >=1.0.0 <2.0.0 @jupyterlab/notebook
>=5.1.0 <5.2.0          >=4.0.0 <5.0.0 @jupyterlab/services
See the log file for details:  /private/tmp/nix-build-jupyterlab-extended.drv-0/jupyterlab-debug-t4le51lo.log
Exiting application: jupyter

Can it be connected to a certificate fail somewhat earlier when

npm notice
jupyterlab-ihaskell-0.0.9.tgz

Fetching URL: https://registry.yarnpkg.com/jupyterlab-ihaskell
Failed to fetch package metadata for 'jupyterlab-ihaskell': URLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'))
Fetching URL: https://registry.yarnpkg.com/jupyterlab-ihaskell
Failed to fetch package metadata for 'jupyterlab-ihaskell': URLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'))
guaraqe commented 4 years ago

The problem is due to the extension. It's an upstream problem, but a temporary workaround is to remove the extension from the environment, which will give code without highlighting:

  jupyterlabWithKernels =
    jupyter.jupyterlabWith {
      kernels = [ ihaskellWithPackages ];
    };
jO-Osko commented 4 years ago

This fix seems to work (it is still compiling and installing, but it gets much much further). I will keep you posted when the setup finishes.

Thank you again.

jO-Osko commented 4 years ago

Using this fix the setup gets much further, but later complains about a missing dependency.

During the first part of installation, I got a segmentation fault and also full system crash.... After re-running the installation I got:

CallStack (from HasCallStack):
  die', called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:950:20 in Cabal-2.4.0.1:Distribution.Simple.Configure
  configureFinalizedPackage, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:460:12 in Cabal-2.4.0.1:Distribution.Simple.Configure
  configure, called at libraries/Cabal/Cabal/Distribution/Simple.hs:596:20 in Cabal-2.4.0.1:Distribution.Simple
  confHook, called at libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:67:5 in Cabal-2.4.0.1:Distribution.Simple.UserHooks
  configureAction, called at libraries/Cabal/Cabal/Distribution/Simple.hs:178:19 in Cabal-2.4.0.1:Distribution.Simple
  defaultMainHelper, called at libraries/Cabal/Cabal/Distribution/Simple.hs:115:27 in Cabal-2.4.0.1:Distribution.Simple
  defaultMain, called at Setup.hs:2:8 in main:Main
Setup: Encountered missing dependencies:
ghc-lib-parser ==8.8.0.20190424  haskell-src-exts ==1.21.*

Fixing the versions for proceeds somewhat further but again errors with the following error:

Preprocessing test suite 'examples' for haskell-src-meta-0.8.5..
Building test suite 'examples' for haskell-src-meta-0.8.5..
[1 of 5] Compiling BF               ( examples/BF.hs, dist/build/examples/examples-tmp/BF.o )
[2 of 5] Compiling Hs               ( examples/Hs.hs, dist/build/examples/examples-tmp/Hs.o )
[3 of 5] Compiling HsHere           ( examples/HsHere.hs, dist/build/examples/examples-tmp/HsHere.o )
[4 of 5] Compiling SKI              ( examples/SKI.hs, dist/build/examples/examples-tmp/SKI.o )
[5 of 5] Compiling Main             ( tests/TestExamples.hs, dist/build/examples/examples-tmp/Main.o )
Linking dist/build/examples/examples ...
Preprocessing test suite 'splices' for haskell-src-meta-0.8.5..
Building test suite 'splices' for haskell-src-meta-0.8.5..
[1 of 1] Compiling Main             ( tests/Splices.hs, dist/build/splices/splices-tmp/Main.o )

tests/Splices.hs:69:77: error:
    Not in scope: data constructor ‘Extension.QuantifiedConstraints’
    Module ‘Language.Haskell.Exts.Extension’ does not export ‘QuantifiedConstraints’.
   |
69 |   (Parser.defaultParseMode { Parser.extensions = [Extension.EnableExtension Extension.QuantifiedConstraints, Extension.EnableExtension Extension.ExplicitForAll] })
   |                                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

builder for '/nix/store/d8jj9abavlwhq5h8s1mm9ipl1a77iv62-haskell-src-meta-0.8.5.drv' failed with exit code 1

(ghc-lib is declared later with ghc-lib-parser = dontHaddock hspkgs.ghc-lib-parser;, haskell-src-exts is not declared anywhere. The error persists irrespective of compatible haskell-src-exts version (1.21.0 or 1.21.1). )

After changing the pinned version of hlint to hlint = hspkgs.callHackage "hlint" "2.2.11" {}; the installation finishes successfully. But it shows no graphs as already said https://github.com/tweag/blog-resources/pull/13#issuecomment-641963585.

Than you for all the support and help 👍 . Even if the graphs aren't showing, the code is working and I am able to play around and can currently graph things in another notebook.

Filip