Closed wyager closed 9 years ago
Ipython 4?
Correct.
: ipython --version
4.0.0
I think this is an installation issue. How did you install ihaskell
? I've installed via stack install
and if I run jupyter notebook
inside the ihaskell
it works.
I used cabal install
and jupyter notebook
. I'll try again with stack
later.
Was there a sandbox involved? Also, did you reinstall all the IHaskell support libraries after installing IHaskell (assuming you had an older version of IHaskell before)? ghc-pkg list
may show you more – perhaps they are installed but broken?
Nope, it's just in my global package store. Here's my ghc-pkg list
output; maybe I missed something.
/Library/Frameworks/GHC.framework/Versions/7.10.2-x86_64/usr/lib/ghc-7.10.2/package.conf.d: Cabal-1.22.4.0 GLURaw-1.5.0.1 GLUT-2.7.0.1 HTTP-4000.2.20 HUnit-1.2.5.2 ObjectName-1.1.0.0 OpenGL-2.12.0.1 OpenGLRaw-2.5.1.0 QuickCheck-2.8.1 StateVar-1.1.0.0 array-0.5.1.0 async-2.0.2 attoparsec-0.13.0.1 base-4.8.1.0 bin-package-db-0.0.0.0 binary-0.7.5.0 rts-1.0 bytestring-0.10.6.0 case-insensitive-1.2.0.4 cgi-3001.2.2.2 containers-0.5.6.2 deepseq-1.4.1.1 directory-1.2.2.0 exceptions-0.8.0.2 fgl-5.5.2.1 filepath-1.4.0.0 (ghc-7.10.2) ghc-prim-0.4.0.0 hashable-1.2.3.3 haskeline-0.7.2.1 haskell-src-1.0.2.0 hoopl-3.10.0.2 hpc-0.6.0.2 hscolour-1.23 html-1.0.1.2 integer-gmp-1.0.0.0 mtl-2.2.1 multipart-0.1.2 network-2.6.2.1 network-uri-2.6.0.3 old-locale-1.0.0.7 old-time-1.1.0.3 parallel-3.2.0.6 parsec-3.1.9 pretty-1.1.2.0 primitive-0.6 process-1.2.3.0 random-1.1 regex-base-0.93.2 regex-compat-0.95.1 regex-posix-0.95.2 scientific-0.3.3.8 split-0.2.2 stm-2.4.4 syb-0.5.1 template-haskell-2.10.0.0 terminfo-0.4.0.1 text-1.2.1.3 tf-random-0.5 time-1.5.0.1 transformers-0.4.2.0 transformers-compat-0.4.0.4 unix-2.7.1.0 unordered-containers-0.2.5.1 vector-0.11.0.0 xhtml-3000.2.1 zlib-0.5.4.2
/Users/williamyager/.ghc/x86_64-darwin-7.10.2/package.conf.d: JuicyPixels-3.2.5.3 MonadRandom-0.4 SHA-1.6.4.2 active-0.2.0.4 adjunctions-4.2.1 aeson-0.8.1.1 aeson-pretty-0.7.2 ansi-terminal-0.6.2.1 ansi-wl-pprint-0.6.7.2 asn1-encoding-0.9.0 asn1-parse-0.9.1 asn1-types-0.3.0 auto-update-0.1.2.2 base-orphans-0.4.3 base16-bytestring-0.1.1.6 base64-bytestring-1.0.0.1 bifunctors-5 blaze-builder-0.4.0.1 blaze-html-0.8.1.0 blaze-markup-0.7.0.2 byteable-0.1.1 bytes-0.15.0.1 bytestring-builder-0.10.6.0.0 cereal-0.4.1.1 circle-packing-0.1.0.4 cmdargs-0.10.13 colour-2.3.3 comonad-4.2.7.2 connection-0.2.5 constraints-0.4.1.3 contravariant-1.3.2 cookie-0.4.1.6 cpphs-1.19.2 cryptohash-0.11.6 cryptonite-0.6 data-default-0.5.3 data-default-class-0.0.1 data-default-instances-base-0.0.1 data-default-instances-containers-0.0.1 data-default-instances-dlist-0.0.1 data-default-instances-old-locale-0.0.1 deepseq-generics-0.1.1.2 diagrams-1.3 diagrams-contrib-1.3.0.4 diagrams-core-1.3.0.2 diagrams-lib-1.3.0.3 diagrams-solve-0.1 diagrams-svg-1.3.1.4 dimensional-0.13.0.2 distributive-0.4.4 dlist-0.7.1.1 dual-tree-0.2.0.6 electrum-mnemonic-0.1.2 enclosed-exceptions-1.0.1.1 extensible-exceptions-0.1.1.4 extra-1.4.1 fast-logger-2.4.1 file-embed-0.0.8.2 filelock-0.1.0.1 fingertree-0.1.1.0 force-layout-0.4.0.2 free-4.12.1 fsnotify-0.2.1 ghc-parser-0.1.7.0 ghc-paths-0.1.0.9 gitrev-1.1.0 groups-0.4.0.0 happstack-server-7.4.4 hashtables-1.2.0.2 haskell-src-exts-1.16.0.1 haskell-src-meta-0.6.0.10 hastache-0.6.1 here-1.2.7 hfsevents-0.1.5 hlint-1.9.21 hourglass-0.2.9 hslogger-1.2.9 http-client-0.4.19 http-client-tls-0.2.2 http-types-0.8.6 ieee754-0.7.6 ihaskell-0.6.4.1 ihaskell-0.6.5.0 ihaskell-aeson-0.3.0.0 ihaskell-juicypixels-0.3.0.0 intervals-0.7.1 ipython-kernel-0.6.1.2 kan-extensions-4.2.2 keyed-0.1.0.0 keyed-0.3.0.0 largeword-1.2.3 lens-4.12.3 lifted-async-0.7.0.1 lifted-base-0.2.3.6 linear-1.19.1.3 lucid-2.9.2 lucid-svg-0.5.0.0 memory-0.7 mime-types-0.1.0.6 mmorph-1.0.4 monad-control-1.0.0.4 monad-loops-0.4.3 monoid-extras-0.4.0.1 mwc-random-0.13.3.2 nats-1 network-info-0.2.0.7 newtype-0.2 numbers-3000.2.0.1 numtype-1.1 optparse-applicative-0.11.0.2 path-0.5.2 path-pieces-0.2.0 pem-0.2.2 polyparse-1.11 prelude-extras-0.4 profunctors-5.1.1 reflection-2 retry-0.6 safe-0.3.9 semigroupoids-5.0.0.3 semigroups-0.16.2.2 sendfile-0.7.9 shelly-1.6.3.3 silently-1.2.5 socks-0.5.4 statestack-0.2.0.4 stm-chans-3.0.0.4 streaming-commons-0.1.12.1 strict-0.3.2 system-argv0-0.1.1 system-fileio-0.3.16.3 system-filepath-0.4.13.4 tagged-0.8.1 tar-0.4.2.1 temporary-1.2.0.3 th-expand-syns-0.3.0.6 th-lift-0.7.2 th-orphans-0.12.2 th-reify-many-0.1.3 threads-0.5.1.3 time-compat-0.1.0.3 tls-1.3.1 transformers-base-0.4.4 uniplate-1.6.12 unix-compat-0.4.1.4 utf8-string-1 uuid-1.3.11 uuid-types-1.0.2 vector-binary-instances-0.2.1.0 void-0.7 word8-0.1.2 x509-1.6.0 x509-store-1.6.0 x509-system-1.6.0 x509-validation-1.6.0 zeromq4-haskell-0.6.3
What's the code you're trying? Perhaps it's an issue with juicypixels
specifically...
Also, you have two versions of ihaskell
installed – that may cause problems. I suggest using ghc-pkg unregister
to remove all the ihaskell
-related packages and then trying again. It's quite possible that having two ihaskell
packages will confuse it, because the ihaskell
extension packages may be linked to the wrong ones, so it refuses to load them... Just a guess.
Tried to reinstall ihaskell
. Looks like 0.7.0.1 doesn't build for some reason, including
Preprocessing executable 'ihaskell' for ihaskell-0.7.0.1...
[1 of 2] Compiling IHaskellPrelude ( main/IHaskellPrelude.hs, dist/build/ihaskell/ihaskell-tmp/IHaskellPrelude.o )
[2 of 2] Compiling Main ( main/Main.hs, dist/build/ihaskell/ihaskell-tmp/Main.o )
main/Main.hs:232:17:
‘implementation’ is not a (visible) field of constructor ‘KernelInfoReply’
<more in the same vein>
Ah, thanks. Make sure you install ipython-kernel >= 0.7
. I forgot to add the lower version bound.
Should be fixed on Hackage now with 0.7.0.2
.
It installs now. However, trying to do anything in a notebook results in no action, and this output from jupyter
:
[I 00:01:42.887 NotebookApp] KernelRestarter: restarting kernel (1/5)
ihaskell: stack: readCreateProcessWithExitCode: runInteractiveProcess: exec: does not exist (No such file or directory)
[I 00:01:45.902 NotebookApp] KernelRestarter: restarting kernel (2/5)
ihaskell: stack: readCreateProcessWithExitCode: runInteractiveProcess: exec: does not exist (No such file or directory)
Do you have stack
installed? If so, what version of it, and what does stack exec env
return?
Ah, I think I inadvertently broke IHaskell for anyone who doesn't have stack
. Damn.
Sorry, should be fixed now.
Success! (Sort of.)
Also, out of curiosity, how do you determine if something is displayable? Do you somehow check if an instance is in scope?
Yes – packages named ihaskell-blah
are loaded and IHaskell.Display.Blah
is imported. Instances of IHaskellDisplay
are imported from these modules. Anything with an IHaskellDisplay
instance is displayed (instead of trying to use a Show
instance). The demo notebook gives an example of writing your own IHaskellDisplay
instances.
Does this happen with all images you can generate? You may also want to check .ihaskell.juicypixels.jpg
manually to see what's going on with that file.
I can help debug this some more tomorrow.
I tried a number of images and pixel formats (including the standard RGB8). Same error.
Where does that file live? Also, is there any particular reason it's JPG over, say, PNG?
My guess is that that file lives in whatever directory your notebook is running in.
No, I don't think there's a reason to prefer JPG over PNG. I didn't write ihaskell-juicypixels
though, so I'm not sure...
Yeah, it was doing some wonky stuff. I fixed the library and changed it to use PNGs (and not use IO). I'll email the author to see if he will update it.
It's in the IHaskell repository, so feel free to make a PR here and I will merge it. I am maintaining ihaskell-juicypixels
and I think this is a pretty safe change.
Oh, cool. Yeah I'll submit a PR.
PR submitted.
Can you explain why it wasn't working before?
Sure. Quoted from PR:
Further detail: the way this used to work was it would save the image to a JPEG file, load the bytes from the file, and then use those. Besides being circuitous, this method also broke because, at some point, hGetContents
(by way of prelude
's readFile
) started checking that it was only reading valid unicode or something, which meant that it would no longer read binary files like JPEGs without crashing.
Strange that this worked originally, then. PR looks good. Will merge once it passes test suite.
It looks like it failed the test suite on a single test on a single version, but I'm not sure if this is my fault. What do you think?
It was just a code formatting issue. I can fix this.
I may just be doing this wrong, but when a code cell evaluates to something that should be displayed nicely (like a JuicyPixels Image), it just says
I already did
cabal install ihaskell-juicypixels
.