Fork me on GitHub
#data-science
<
2019-03-04
>
genekim20:03:00

Hello! I have a super-rookie question about Clojupyter, and for that matter, Jupyter, despite having studied @gigasquid’s super example notebook (https://github.com/gigasquid/cats-dogs-cortex-redux/blob/master/Cats%20and%20Dogs%20in%20Cortex%20(Redux).ipynb), as well as several others. As part of a larger project, I've spent a couple of months analyzing a large data set with Clojure. it is currently in a lein project, and has over a thousand lines of code in it. I need to share this data with my research teammates, and we've settled on Jupyter to chronicle all the data transforms and anlysis. So now I'm learning Jupyter, and installed Clojupyter. (lein-jupyter kept crashing. I'll post details later.) However, in Clojupyter, I'm having problems calling any of the code that already exists in is project. Maybe I'm totally misunderstanding the Jupyter model. But I'm hoping I can call code that I already wrote? I can do things like:

; Requiring Clojure libraries works.
(require '[clojure.java.shell :as shell])
But any attempt load in code from under ./src/analyze that are under my lein project doesn't work.
; this blows up
(require '[analyze.stage9])

Execution error (FileNotFoundException) at user/eval3808 (REPL:2).
Could not locate analyze/stage9__init.class, analyze/stage9.clj or analyze/stage9.cljc on classpath.

; not even loading the files works
(clojure.core/load "src/analyze/stage9")

Execution error (FileNotFoundException) at user/eval3810 (REPL:2).
Could not locate src/analyze/stage9__init.class, src/analyze/stage9.clj or src/analyze/stage9.cljc on classpath.

; here are the source files under ./src/analyze
(-> (shell/sh "ls" "src/analyze") :out println)

:
:
stage9.clj
Any insights on what I am doing wrong? In the ideal, I'd love to be able to load in all my local source files/namespaces, and then call functions that are in them? Thank you so much in advance! Full PDF of Jupyter notebook attached! (PS: hi @metasoarous 🙂

genekim20:03:47

Oops. Gotta scrub that PDF file... stand by. 🙂

genekim20:03:32

Umm. I think I ran out of Slack upload space. Here's a Dropbox link to a PDF file of the Jupyter notebook: https://www.dropbox.com/s/9vvjvurd14rcjkq/test2.pdf?dl=0 Thx!!!

genekim21:03:48

Umm, maybe I'm supposed to use lein-jupyter instead to take care of CLASSPATH, etc? Here's the error I get when I run lein jupyter notebook and then create a new "lein-clojure" notebook...

zane23:03:23

Did you wind up getting this resolved?

genekim00:03:18

Not yet! Sitting back down with @gigasquid repo and seeing how she does the ‘ns’ and ‘require’ form, and seeing if i can make that work. Was hoping i was making an obvious mistake that people here would quickly spot. :) Just curious: do people here use “clojupyter” or “lein-Jupyter”? Thanks all!

zane06:03:33

lein-jupyter uses the Clojupyter kernel.

zane06:03:18

If you're using lein-jupyter you should definitely let it handle setting up the classpath.

zane07:03:17

If I were starting a new project today I'd probably have a look at IClojure, as gigasquid recommends.

genekim14:03:22

@U050CT4HR holy smokes. I saw that error message from lein-Jupyter about not manually setting class path — I barely know what one is, let alone go changing it. :) Trying to figure out how to resolve that error. I absolutely want to use what lein provides. Thx for your comments, Zane!

genekim00:03:18

Not yet! Sitting back down with @gigasquid repo and seeing how she does the ‘ns’ and ‘require’ form, and seeing if i can make that work. Was hoping i was making an obvious mistake that people here would quickly spot. :) Just curious: do people here use “clojupyter” or “lein-Jupyter”? Thanks all!