# Stack: Failures, Errors, Frustrations

**URL:** <https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761>\
**Category:** Learn\
**Created:** [July 13, 2022, 6:37am UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761 "2022-07-13T06:37:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![dalendisto](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/dalendisto/32/2434_2.png) [@dalendisto](https://discourse.haskell.org/u/dalendisto)\
**Post date:** [July 13, 2022, 6:37am UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/1 "2022-07-13T06:37:53Z")

</div>

So, I am at the point, where I want to expand my skills and start working with libraries. And here is where I run into an unbreakable brick wall. I have started numerous Stack projects to follow along tutorials or build my own projects. Every time I get these Errors after following the exact steps on the Stack site, or what the tutorials say I should do.

1: Could not find module ‘Data.Gi.Base’ or ‘aeson’  
It is not a module in the current program, or in any known package.not found

2: I edit the package.yaml file like that :  
dependencies:

- base \>= 4.7 && \< 5
- gi-gtk == 3.0.\*
- gi-gtk-hs
- haskell-gi-base

and get that output after stack build :  
haskell-gi-base\> version \>=2.42 is required but it could not be found.  
haskell-gi-base\>  
Progress 1/15  
…  
Process exited with code: ExitFailure 1

I really need some help.

---

<div class="post-metadata">

**Author:** ![sjakobi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/sjakobi/32/614_2.png) [@sjakobi](https://discourse.haskell.org/u/sjakobi)\
**Post date:** [July 13, 2022, 11:04am UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/2 "2022-07-13T11:04:47Z")

</div>

What does your `stack.yaml` look like? Did you check that all your dependencies are part of the (`lts-*`?) snapshot you’re using? Otherwise, you may need to add some [`extra-deps`](https://docs.haskellstack.org/en/stable/yaml_configuration/#extra-deps).

I also think that you elided some necessary information from the error messages.

**EDIT** : In particular, it’s unclear what the `version >= 2.42` message is referring to.

---

<div class="post-metadata">

**Author:** ![dalendisto](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/dalendisto/32/2434_2.png) [@dalendisto](https://discourse.haskell.org/u/dalendisto)\
**Post date:** [July 13, 2022, 11:25am UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/3 "2022-07-13T11:25:16Z")

</div>

Hi sjakobi,  
thank you very much for even asking some questions and trying to help.  
This is the version:  
[https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/8.yaml](https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/8.yaml)

Me neither. I just followed this guy, did everything he did :  
[Building a GTK App With Haskell (In Under An Hour) - YouTube](https://www.youtube.com/watch?v=ViW-bcNQ6Lc) (look at 7:04 min)  
When I do stack build I get several of these “ExitFailiure” things…

Now the question to your question. How do I know (can I find out) what extra deps are needed.  
I always tell myself “If you want to feel stupid and useless, learn programming” 😃  
Really appreciate your help

---

<div class="post-metadata">

**Author:** ![chreekat](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/chreekat/32/2669_2.png) [@chreekat](https://discourse.haskell.org/u/chreekat)\
**Post date:** [July 13, 2022, 11:35am UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/4 "2022-07-13T11:35:39Z")

</div>

> [@dalendisto](#):
>
> This is the version:

Hey, you posted a link to something that stack uses under the hood. 🙂 You shouldn’t need that file in your project directory.

What about your package’s specific stack.yaml? It’s literally called “stack.yaml” and usually gets initialized by `stack init`.

---

<div class="post-metadata">

**Author:** ![dalendisto](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/dalendisto/32/2434_2.png) [@dalendisto](https://discourse.haskell.org/u/dalendisto)\
**Post date:** [July 13, 2022, 11:49am UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/5 "2022-07-13T11:49:58Z")

</div>

Hey chreekat,  
I just copied and pasted that link from the “stack.yaml” file. It is under the  
resolver:  
Url: "here is that link.  
Cheers Leo

---

<div class="post-metadata">

**Author:** ![sjakobi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/sjakobi/32/614_2.png) [@sjakobi](https://discourse.haskell.org/u/sjakobi)\
**Post date:** [July 13, 2022, 11:56am UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/6 "2022-07-13T11:56:03Z")

</div>

Note that the app that you’re trying to copy is using lts-19.7: [stack.yaml · main · Derek Taylor / ByeBye · GitLab](https://gitlab.com/dwt1/byebye/-/blob/main/stack.yaml#L20-21)

lts-19.7 is [a bit different](https://www.stackage.org/diff/lts-19.7/lts-19.8) from lts-19.8, but I doubt that this is where your problems are coming from.

Can you show us a bit more of the context of that `version >= 2.42` error you pasted? What package is it referring to?

---

<div class="post-metadata">

**Author:** ![dalendisto](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/dalendisto/32/2434_2.png) [@dalendisto](https://discourse.haskell.org/u/dalendisto)\
**Post date:** [July 13, 2022, 11:57am UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/7 "2022-07-13T11:57:35Z")

</div>

Just give me a minute or 5. Out of frustration I deleted it. But I will set it up quickly…

---

<div class="post-metadata">

**Author:** ![dalendisto](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/dalendisto/32/2434_2.png) [@dalendisto](https://discourse.haskell.org/u/dalendisto)\
**Post date:** [July 13, 2022, 12:04pm UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/8 "2022-07-13T12:04:52Z")

</div>

here is exactly what I am doing.  
1: stack new byebye  
2: cd byebye  
3: stack setup  
4: open package.yaml and add:

- gi-gtk == 3.0.\*
- gi-gtk-hs
- haskell-gi-base

5: safe  
6: stack build.

output:

haskell-gi-base\> configure  
haskell-gi-base\> Configuring haskell-gi-base-0.26.0…  
haskell-gi-base\> Cabal-simple\_mPHDZzAJ\_3.4.1.0\_ghc-9.0.2: The pkg-config package ‘gobject-2.0’  
haskell-gi-base\> version \>=2.42 is required but it could not be found.  
haskell-gi-base\>  
Progress 1/15

– While building package haskell-gi-base-0.26.0 (scroll up to its section to see the error) using:  
/home/lennaet/.stack/setup-exe-cache/x86\_64-linux-tinfo6/Cabal-simple\_mPHDZzAJ\_3.4.1.0\_ghc-9.0.2 --builddir=.stack-work/dist/x86\_64-linux-tinfo6/Cabal-3.4.1.0 configure --with-ghc=/home/lennaet/.stack/programs/x86\_64-linux/ghc-tinfo6-9.0.2/bin/ghc-9.0.2 --with-ghc-pkg=/home/lennaet/.stack/programs/x86\_64-linux/ghc-tinfo6-9.0.2/bin/ghc-pkg-9.0.2 --user --package-db=clear --package-db=global --package-db=/home/lennaet/.stack/snapshots/x86\_64-linux-tinfo6/bf2b22f4a5ae48506d221d81a63a06f9c3cb87d893cb0fd275e19148a620237e/9.0.2/pkgdb --libdir=/home/lennaet/.stack/snapshots/x86\_64-linux-tinfo6/bf2b22f4a5ae48506d221d81a63a06f9c3cb87d893cb0fd275e19148a620237e/9.0.2/lib --bindir=/home/lennaet/.stack/snapshots/x86\_64-linux-tinfo6/bf2b22f4a5ae48506d221d81a63a06f9c3cb87d893cb0fd275e19148a620237e/9.0.2/bin --datadir=/home/lennaet/.stack/snapshots/x86\_64-linux-tinfo6/bf2b22f4a5ae48506d221d81a63a06f9c3cb87d893cb0fd275e19148a620237e/9.0.2/share --libexecdir=/home/lennaet/.stack/snapshots/x86\_64-linux-tinfo6/bf2b22f4a5ae48506d221d81a63a06f9c3cb87d893cb0fd275e19148a620237e/9.0.2/libexec --sysconfdir=/home/lennaet/.stack/snapshots/x86\_64-linux-tinfo6/bf2b22f4a5ae48506d221d81a63a06f9c3cb87d893cb0fd275e19148a620237e/9.0.2/etc --docdir=/home/lennaet/.stack/snapshots/x86\_64-linux-tinfo6/bf2b22f4a5ae48506d221d81a63a06f9c3cb87d893cb0fd275e19148a620237e/9.0.2/doc/haskell-gi-base-0.26.0 --htmldir=/home/lennaet/.stack/snapshots/x86\_64-linux-tinfo6/bf2b22f4a5ae48506d221d81a63a06f9c3cb87d893cb0fd275e19148a620237e/9.0.2/doc/haskell-gi-base-0.26.0 --haddockdir=/home/lennaet/.stack/snapshots/x86\_64-linux-tinfo6/bf2b22f4a5ae48506d221d81a63a06f9c3cb87d893cb0fd275e19148a620237e/9.0.2/doc/haskell-gi-base-0.26.0 --dependency=base=base-4.15.1.0 --dependency=bytestring=bytestring-0.10.12.1 --dependency=containers=containers-0.6.4.1 --dependency=text=text-1.2.5.0 --exact-configuration --ghc-option=-fhide-source-paths  
Process exited with code: ExitFailure 1

---

<div class="post-metadata">

**Author:** ![sjakobi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/sjakobi/32/614_2.png) [@sjakobi](https://discourse.haskell.org/u/sjakobi)\
**Post date:** [July 13, 2022, 12:13pm UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/9 "2022-07-13T12:13:01Z")

</div>

> haskell-gi-base\> Cabal-simple\_mPHDZzAJ\_3.4.1.0\_ghc-9.0.2: The pkg-config package ‘gobject-2.0’  
> haskell-gi-base\> version \>=2.42 is required but it could not be found.

This `pkg-config package` bit is referring to a system dependency which you need to install via your package manager. `stack` can only handle Haskell library dependencies.

On Ubuntu, I can use `apt-file find` to find the package that provides a certain system library:

```haskell
$ apt-file find /gobject.h
guile-gnome2-dev: /usr/include/guile-gnome-2/guile-gnome-gobject/gobject.h
libglib2.0-dev: /usr/include/glib-2.0/gobject/gobject.h
r-cran-rgtk2: /usr/lib/R/site-library/RGtk2/include/RGtk2/gobject.h

```

So I would need to install `libglib2.0-dev` to fix this. On your system, the exact commands and package names might be a bit different.

---

<div class="post-metadata">

**Author:** ![jaror](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/jaror/32/3271_2.png) [@jaror](https://discourse.haskell.org/u/jaror)\
**Post date:** [July 13, 2022, 12:17pm UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/10 "2022-07-13T12:17:41Z")

</div>

Also check [the installation instructions of `haskell-gi`](https://github.com/haskell-gi/haskell-gi#installation).

---

<div class="post-metadata">

**Author:** ![dalendisto](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/dalendisto/32/2434_2.png) [@dalendisto](https://discourse.haskell.org/u/dalendisto)\
**Post date:** [July 13, 2022, 12:25pm UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/11 "2022-07-13T12:25:01Z")

</div>

Well, I am using Ubuntu as well but…Command ‘apt-file’ not found.

Apparently I have no idea what I am doing. I thought stack is the package manager…do I need another one?!? Why cant it be as straight forward as in Elm…buuaaaaahhhh 😖

---

<div class="post-metadata">

**Author:** ![atravers](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@atravers](https://discourse.haskell.org/u/atravers)\
**Post date:** [July 13, 2022, 12:31pm UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/12 "2022-07-13T12:31:11Z")

</div>

> [@dalendisto](#):
>
> Why can’t it be as straight forward as in Elm […]

…is Elm written in Elm?

> [@dalendisto](#):
>
> Well, I am using Ubuntu as well but…`Command ‘apt-file’ not found.`

`apt-file` is an administrative command. As I dimly recall, you’ll need to prefix those with `sudo` in Ubuntu (or log in to your system as an admin and then run it).

---

<div class="post-metadata">

**Author:** ![dalendisto](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/dalendisto/32/2434_2.png) [@dalendisto](https://discourse.haskell.org/u/dalendisto)\
**Post date:** [July 13, 2022, 12:33pm UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/13 "2022-07-13T12:33:17Z")

</div>

Hey jaror,  
just followed the instructions and  
now it seems to be doing what its supposed to do…How do you know these things?

---

<div class="post-metadata">

**Author:** ![dalendisto](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/dalendisto/32/2434_2.png) [@dalendisto](https://discourse.haskell.org/u/dalendisto)\
**Post date:** [July 13, 2022, 12:34pm UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/14 "2022-07-13T12:34:40Z")

</div>

Elm is written is Haskell…as far as I know. But I am not Mr. knowitall…as it is apparent 😂

---

<div class="post-metadata">

**Author:** ![jaror](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/jaror/32/3271_2.png) [@jaror](https://discourse.haskell.org/u/jaror)\
**Post date:** [July 13, 2022, 12:45pm UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/15 "2022-07-13T12:45:13Z")

</div>

I’ve encountered similar issues before when trying to use GTK or other C libraries in Haskell. It basically comes down to having spent ~~too much~~ more time on it.

---

<div class="post-metadata">

**Author:** ![dalendisto](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/dalendisto/32/2434_2.png) [@dalendisto](https://discourse.haskell.org/u/dalendisto)\
**Post date:** [July 13, 2022, 12:53pm UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/16 "2022-07-13T12:53:31Z")

</div>

Never in a million years would I have solved this issue by myself. Thanks to all of you!!!  
But there is still this other issue.

now when I do the imports

import Data.GI.Base  
import qualified GI.Gtk

why do I get these messages:

Could not find module ‘Data.GI.Base’  
It is not a module in the current program, or in any known package  
???

Have the same with aeson, random etc. But the program compiles…

---

<div class="post-metadata">

**Author:** ![jaror](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/jaror/32/3271_2.png) [@jaror](https://discourse.haskell.org/u/jaror)\
**Post date:** [July 13, 2022, 1:10pm UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/17 "2022-07-13T13:10:42Z")

</div>

The “Could not find module …” error message usually means that you are missing a dependency in your `package.yaml` file.

The `Data.GI.Base` is a bit confusing because I believe you say that you have `haskell-gi-base` listed in your `package.yaml`. That should be enough. Maybe you should check it again? Also note that there might be multiple `dependencies:` fields in one `package.yaml` file.

For the others like `aeson` and `random` it seems you are just missing the dependency in your `package.yaml`.

There are some more pointers about adding dependencies in [the Stack documentation](https://docs.haskellstack.org/en/stable/GUIDE/#adding-dependencies).

---

<div class="post-metadata">

**Author:** ![dalendisto](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/dalendisto/32/2434_2.png) [@dalendisto](https://discourse.haskell.org/u/dalendisto)\
**Post date:** [July 13, 2022, 1:15pm UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/18 "2022-07-13T13:15:57Z")

</div>

Ok, homework for me. Read the complete Stack documentation…  
Well, I list all these dependencies like so

dependencies :  
base  
classy-prelude  
time  
aeson  
random

safe the file do stack build and still get the same errors…

---

<div class="post-metadata">

**Author:** ![jaror](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/jaror/32/3271_2.png) [@jaror](https://discourse.haskell.org/u/jaror)\
**Post date:** [July 13, 2022, 1:23pm UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/19 "2022-07-13T13:23:42Z")

</div>

Can you post the full `package.yaml` file that you are using? Preferably via [https://pastebin.com](https://pastebin.com) or something like that.

---

<div class="post-metadata">

**Author:** ![dalendisto](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/dalendisto/32/2434_2.png) [@dalendisto](https://discourse.haskell.org/u/dalendisto)\
**Post date:** [July 13, 2022, 1:30pm UTC](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761/20 "2022-07-13T13:30:47Z")

</div>

I dont have an account for pastebin yet. So here is the entire file content.

```haskell
name: hauth
version: 0.1.0.0
github: "githubuser/hauth"
license: BSD3
author: "Author name here"
maintainer: "example@example.com"
copyright: "2022 Author name here"

extra-source-files:
- README.md
- ChangeLog.md

# Metadata used when publishing your package
# synopsis: Short description of your package
# category: Web

# To avoid duplicated efforts in documentation and dealing with the
# complications of embedding Haddock markup inside cabal files, it is
# common to point users to the README.md file.
description: Please see the README on GitHub at <https://github.com/githubuser/hauth#readme>

dependencies:
- base
- classy-prelude
- time
- aeson
- random

default-extensions: 
- NoImplicitPrelude 
- OverloadedStrings
- QuasiQuotes

library:
  source-dirs: src

executables:
  hauth-exe:
    main: Main.hs
    source-dirs: app
    ghc-options:
    - -threaded
    - -rtsopts
    - -with-rtsopts=-N
    dependencies:
    - hauth

tests:
  hauth-test:
    main: Spec.hs
    source-dirs: test
    ghc-options:
    - -threaded
    - -rtsopts
    - -with-rtsopts=-N
    dependencies:
    - hauth

```

[Next page](https://discourse.haskell.org/t/stack-failures-errors-frustrations/4761.md?page=2)
