I want to install and run an example program from the Haskell neural library.
I'm pretty new to this and am not sure on whether the issue is with my installation method, my environment or the library(ies?) itself. How do I get one of the example programs running?
I tried stack install neural
and got
Error: [S-4804]
Stack failed to construct a build plan.
While constructing the build plan, Stack encountered the following errors. The 'Stack configuration' refers to the set of package versions specified
by the snapshot (after any dropped packages, or pruned GHC boot packages; if a boot package is replaced, Stack prunes all other such packages that
depend on it) and any extra-deps:
In the dependencies for neural-0.3.0.1:
* pipes-zlib needed, but no version is in the Stack configuration (latest matching version is 0.4.4.2).
needed since neural is a build target.
Some different approaches to resolving some or all of this:
* Recommended action: try adding the following to your extra-deps in C:\Users\DELL\AppData\Roaming\stack\global-project\stack.yaml
(project-level configuration):
- pipes-zlib-0.4.4.2@sha256:eabd5aa29a030ecdeade80cfeb1787adc181bcf8fd378cb7b695b2af6cb26af6,1947
After following the recommended action,
While executing the build plan, Stack encountered the error:
[S-7011]
While building package neural-0.3.0.1 (scroll up to its section to
see the error) using:
C:\Users\DELL\AppData\Roaming\stack\setup-exe-cache\x86_64-windows\Cabal-simple_9p6GVs8J_3.10.1.0_ghc-9.6.4.exe --verbose=1 --builddir=.stack-work\dist\ab060f89 build --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
After this, I tried cabal install neural
instead, and got
Failed to build neural-0.3.0.1.
Build log (
C:\cabal\logs\ghc-9.4.8\neural-0.3.0.1-41d9f5ecd7dfa38845ecaf8f9f447447e7958da2.log
):
Preprocessing library for neural-0.3.0.1..
Building library for neural-0.3.0.1..
[ 1 of 22] Compiling Data.MyPrelude ( src\Data\MyPrelude.hs, dist\build\Data\MyPrelude.o )
src\Data\MyPrelude.hs:55:1: warning: [-Wunused-imports]
The import of `Data.Monoid' is redundant
except perhaps to import instances from `Data.Monoid'
To import instances alone, use: import Data.Monoid()
|
55 | import Data.Monoid ((<>))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ 2 of 22] Compiling Data.FixedSize.Class ( src\Data\FixedSize\Class.hs, dist\build\Data\FixedSize\Class.o )
.........
|
120 | vtail (Vector v) = Vector $ VS.tail v
| ^
[17 of 22] Compiling Numeric.Neural.Model ( src\Numeric\Neural\Model.hs, dist\build\Numeric\Neural\Model.o )
src\Numeric\Neural\Model.hs:139:10: error:
Duplicate instance declarations:
instance (NFData (s a), NFData (t a)) => NFData (Product s t a)
-- Defined at src\Numeric\Neural\Model.hs:139:10
instance [safe] (Control.DeepSeq.NFData1 f,
Control.DeepSeq.NFData1 g, NFData a) =>
NFData (Product f g a)
-- Defined in `Control.DeepSeq'
|
139 | instance (NFData (s a), NFData (t a)) => NFData (Product s t a) where
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: cabal-3.10.2.1.exe: Failed to build neural-0.3.0.1 (which is requiredby exe:sqrt from neural-0.3.0.1, exe:sin from neural-0.3.0.1 and others). See
the build log above for details.
At this point, I assume it's an issue with the source itself?
When I try installing other related libraries (e.g, grenade) using stack, I get something like
fail (backjumping, conflict set: singletons, template-haskell,
th-desugar)
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: grenade, text, singletons,
template-haskell, th-desugar, base
I was able to build neural
with Stack, but I started with a clone of the Git repository instead of trying stack install neural
(which looks like it's broken). So, try:
git clone https://github.com/brunjlar/neural.git
cd neural
stack build
The first time, I got a dreaded GHC panic:
$ stack build
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-unknown-linux):
Prelude.chr: bad argument: 3179719811
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Error: [S-6374]
While building simple Setup.hs (scroll up to its section to see the error) using:
/u/buhr/.ghcup/ghc/8.0.2/bin/ghc -rtsopts -threaded -clear-package-db
-global-package-db -hide-all-packages -package base -main-is
StackSetupShim.mainOverride -package Cabal-1.24.2.0
/scratch/buhr/haskell/stack/setup-exe-src/setup-6HauvNHV.hs
/scratch/buhr/haskell/stack/setup-exe-src/setup-shim-6HauvNHV.hs
-o /scratch/buhr/haskell/stack/setup-exe-cache/x86_64-linux/tmp-Cabal-simple_6HauvNHV_1.24.2.0_ghc-8.0.2
which seems to result from some buggy Stack behavior when switching between old and new GHC versions. If you get this error, take a look at the directory referenced at the end of the message (in my case, /scratch/buhr/haskell/stack/setup-exe-src
), delete any interface files in that directory (extension .hi
), and try rebuilding.
As per @leftroundabout's comment, this might be abandonware, but it may be suitable for flower identification purposes:
$ stack exec iris
read 150 samples
generation learning rate model error accuracy
1000 0.0833 0.324557 0.9600
2000 0.0714 0.293898 0.9800
3000 0.0625 0.291766 0.9733
4000 0.0556 0.283495 0.9867
5000 0.0500 0.282830 0.9867
6000 0.0455 0.281650 0.9733
7000 0.0417 0.279772 0.9800
8000 0.0385 0.279185 0.9867
9000 0.0357 0.280861 0.9800
10000 0.0333 0.278089 0.9867
11000 0.0312 0.281700 0.9800
12000 0.0294 0.277957 0.9867
13000 0.0278 0.277410 0.9867
14000 0.0263 0.277250 0.9867
15000 0.0250 0.276689 0.9800
16000 0.0238 0.277031 0.9867
17000 0.0227 0.277748 0.9867
18000 0.0217 0.277142 0.9867
19000 0.0208 0.275976 0.9867
20000 0.0200 0.275764 0.9867
21000 0.0192 0.276158 0.9867
reached prediction accuracy of 0.993 after 21500 generations