-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot install ihaskell-display widgets with stack #715
Comments
Thank you for closing my issue, now I'm going to close yours) I did closer examination of how Stack works and why we have such behavior (it was an scenario in my issue which can be stably reproduced on current repo). tl;dr; To fix your must place stack.yaml to the folder with notebooks (or any parent folder). Stack.yaml should be like this: flags:
ihaskell:
binpkgdb: false
packages:
- location:
git: https://github.com/gibiansky/IHaskell.git
commit: f39b812fdcc5566210f9960f8218c5fc7fd40a77
subdirs:
- .
- ./ipython-kernel
- ./ghc-parser
- ./ihaskell-display/ihaskell-aeson
- ./ihaskell-display/ihaskell-blaze
- ./ihaskell-display/ihaskell-charts
- ./ihaskell-display/ihaskell-diagrams
- ./ihaskell-display/ihaskell-gnuplot
- ./ihaskell-display/ihaskell-hatex
- ./ihaskell-display/ihaskell-juicypixels
- ./ihaskell-display/ihaskell-magic
- ./ihaskell-display/ihaskell-plot
- ./ihaskell-display/ihaskell-static-canvas
- ./ihaskell-display/ihaskell-widgets
extra-deps: []
resolver: lts-9.0 Or just run from the IHaskell directory. In this case everything under ihaskell-display/* will not work, because each directory contains it's own stack.yaml created under assumption that all other libraries are already installed, which is not true. Everything under other directories will work. Let's turn to details. Stack maintains it environment by taking packages of specific GHC version (defined by resolver), then installed packages related to specific version of Stackage database, then custom packages, defined in stack.yaml and installed to project-local database (under .stack-work folder). Three statements can help clue the things together:
Now back to IHaskell. To make IHaskell works all your need is working Haskell environment, IHaskell binary and Jupyter of course. So, if your just issue
As you can see, we have three section here: ghc-8.0.2 packages, Stackage database packages and IHaskell local packages. All IHaskell modules installed to project local database, IHaskell packages not included to lts-9.0, so issuing same command from different folder will return same first two sections, but without IHaskell packages:
Running
This is because ihaskell-widgets has it's own stack.yaml, which does not include ihaskell modules and they also not in lts-9.0. So, if your enter Examples folder of ihaskell-widgets and try to run notebook, IHaskell will create kernel instance with Stack. Stack will search stack.yaml (or, possibly, just working directory, I'm not sure in exact behavior) an will find one of ihaskell-widgets. Which does not contain any IHaskell packages. Thus, attempt to import any IHaskell module will fail. |
Got few more thoughts about this problem. I think there is a still bug in IHaskell. First, each of ihaskell-display/* package “claims” that it can be built with lts-9.0 along. This is wrong, because lts-9.0 does not include ihaskell. Second, regardless it may seem non-essential issue, it really affects newcomers. People want to check-out the code, compile it and click over examples to get an overall idea. If code does not work, no one will spend his time to sort things out. Most peple will just say “ok, huskell sucks, it does not work”. So, it’s important to make it work out of the box. |
I agree that this is something worth fixing. One thing I looked into was installing the display modules into Stack's |
I've found 2 problem preventing from running notebooks from ihaskell-display/* folders.
|
Thanks for looking into it 😄. It sounds like you're focused on the problem of running the display notebooks from the source repository itself, and I would like a solution where the display modules are available to all IHaskell notebooks I create. However, if you'd like to submit a pull request with your changes that would be welcome. |
To make display modules work, you should use stack.yaml I've posted in my first message. It can be either in notebook folder or in global-project folder (in the latter case make sure there is no another stack.yaml, which will override global-project). Then just install it by |
Hmm, in that case, it might be better to use the Nix method, because that makes the display modules available even in the presence of a |
@schernichkin I'm not sure I understand the prescription. Can the folder just be an arbitrary folder or do I need to make a new stack project (with @vaibhavsagar This may be related to the fact that I don't really understand the "Where are my packages" section of the docs... Would it be possible to add a little more detail (or a little less detail but a little more of a cookbook!)? To be more specific, if I have a package that I would usually install (or have already installed) via cabal so that ghc sees them, what are the instructions? |
@defjaf |
Hi, after reading through your comments on this issue, I think I have found an elegant solution: I have pretty much copied the contents from the stack.yaml file that @schernichkin's kindly supplied here into my global stack.yaml file under ~/.stack/global/stack.yaml. You can then go to any directory that is not a stack project (for example, say, your Desktop), and simply run @schernichkin: I don't understand why you say "the global stack project is pretty useless". I think for this kind of setup, where you want some libraries installed to be visible everywhere, the global stack project is exactly what we want. As a side note, on my Mac I found this blog post to be very useful: You can basically set up ihaskell to even work without invoking |
If you can reproduce this approach using the global stack.yaml project, perhaps this should be put into the docs. It's certainly quite a bad design aspect that in order to run any notebook with correct display, you'd have to place it into the ihaskell code directory in order for it to work. |
I'm satisfied with the approach of putting the |
That's a very elegant solution, thank you @stschiff . We should incorporate that solution into the |
@jamesdbrock opening an IHaskell notebook in the |
I don't have an Opening JupyterLab notebooks in a Stack project directory with a custom |
Here is a complete Docker Stacks image which uses @stschiff 's ideas about using the stack global project to install IHaskell in such a way that notebooks can be stored in and launched from any directory, no https://github.com/jamesdbrock/ihaskell-notebook |
I've built the
ihaskell-display/*
modules and installedihaskell
withstack
, but I can't use any widget functionality and my attempts to importIHaskell.Display.Widgets
are unsuccessful (Failed to load interface for ‘IHaskell.Display.Widgets’). Is there something simple I'm missing?The text was updated successfully, but these errors were encountered: