eval / deps-try

Try out Clojure (libraries) via rebel-readline
MIT License
120 stars 4 forks source link

make installing simpler #5

Open eval opened 1 year ago

eval commented 1 year ago

Feedback from /r/clojure:

it'd be lovely to have a ready-to-use binary release instead of having to install bbin from a Homebrew (because that would be like third package manager I have on my Linux, which is two more than a reasonable amount).

eval commented 1 year ago

@lockie homebrew installation was just released: brew install eval/brew/deps-try.
Standalone released could improve installation further.

lockie commented 1 year ago

@eval thank you! Unfortunately trying to start deps-try.jar from the Releases section yields the following error:

$ java -jar deps-try.jar
Error: Could not find or load main class eval.deps_try
Caused by: java.lang.ClassNotFoundException: eval.deps_try
eval commented 1 year ago

@lockie it's an uberjar that can be run by babashka (I'll update the url to reflect that). Quick experiment to produce a java uberjar yields a jar over 800MB...

lockie commented 1 year ago

Oh, got it. Sorry, I'm still new to the Java world :sweat_smile: Trying to run deps-try uberjar with bb, I'm getting another error though:

Clojure tools not yet in expected location: /home/andrew/.deps.clj/1.11.1.1257/ClojureTools/clojure-tools-1.11.1.1257.jar
Downloading https://download.clojure.org/install/clojure-tools-1.11.1.1257.zip to /home/andrew/.deps.clj/1.11.1.1257/ClojureTools/tools.zip
Unzipping /home/andrew/.deps.clj/1.11.1.1257/ClojureTools/tools.zip ...
Successfully installed clojure tools!
* run-java-tool was invoked directly
* run-java-tool should only be used via symlinks to it
----- Error --------------------------------------------------------------------
Type:     java.io.FileNotFoundException
Message:  /var/tmp/cache/andrew/clojure/1E81C60BC0AE3386072E94F5C403ECA7.cp (No such file or directory)
Location: eval/deps_try.clj:12:1

----- Context ------------------------------------------------------------------
 8:    [clojure.java.io :as io]))
 9:
10: (def init-cp (get-classpath))
11:
12: (deps/add-deps '{:deps {org.clojure/tools.gitlibs {:mvn/version "2.4.181"}}})
    ^--- /var/tmp/cache/andrew/clojure/1E81C60BC0AE3386072E94F5C403ECA7.cp (No such file or directory)
13:
14: (require '[eval.deps-try.deps :as try-deps]
15:          '[babashka.fs :as fs] :reload
16:          '[babashka.http-client] :reload) ;; reload so we use the dep, not the built-in
17:

----- Stack trace --------------------------------------------------------------
clojure.java.io/fn--11617                       - <built-in>
clojure.java.io/fn--11569/G--11523--11576       - <built-in>
clojure.java.io/fn--11591                       - <built-in>
clojure.java.io/fn--11530/G--11519--11537       - <built-in>
clojure.java.io/reader                          - <built-in>
... (run with --debug to see elided elements)
clojure.core/with-bindings*                     - <built-in>
babashka.impl.deps/add-deps/fn--26938           - <built-in>
babashka.impl.deps/add-deps                     - <built-in>
eval.deps-try                                   - eval/deps_try.clj:12:1
user                                            - <expr>:1:10
eval commented 1 year ago

Was this after just running deps-try or deps-try some/lib?
Does clj -Sdeps '{:deps {metosin/malli {:mvn/version "RELEASE"}}}' start a repl? Does starting deps-try thereafter work?

lockie commented 1 year ago

Just a regular deps-try. The command you've provided indeed does start a repl after downloading a bunch of stuff. Running deps-try afterwards unfortunately produces the very same error (but the log starts with * run-java-tool was invoked directly now). Perhaps it has something to do with the weird way I have Clojure installed? I've done that with Guix package manager that runs on top of my distribution (which would be Gentoo GNU/Linux).

eval commented 1 year ago

I tried installing Guix on a Gentoo Docker instance but abandoned when issues regarding kernel settings came up... so the following is some guess-work:

You could verify that the following is indeed the minimal case (this gets deps-try out of the equation): bb -e '(babashka.deps/add-deps (quote {:deps {org.clojure/tools.gitlibs {:mvn/version "2.4.181"}}}))(prn :success)'

Then you might try checking the permissions of the cache-folder. Otherwise play around with env-settings CLJ_CACHE or XDG_CACHE_HOME: env CLJ_CACHE=~/tmp/clj-cache deps-try: env CLJ_CACHE=~/tmp/clj-cache bb -e '(babashka.deps/add-deps (quote {:deps {org.clojure/tools.gitlibs {:mvn/version "2.4.181"}}}))(prn :success)'.

lockie commented 1 year ago

Unfortunately all of the commands you've provided fail with the similar error message, only when I specify different CLJ_CACHE, they fail to find the mysterious file /tmp/clj-cache/1E81C60BC0AE3386072E94F5C403ECA7.cp, while the folder in question only contains the following files: 1151453926.basis, 1151453926.cp and 1151453926.libs. I feel like I might be hitting some bug in Clojure/Babashka infrastructure...

eval commented 1 year ago

😞 Maybe worth to bring this up in the babashka-channel of the Clojurians-Slack or Basbashka issue-list...

lockie commented 1 year ago

I'll do that. Thank you Gert!

eval commented 1 year ago

@lockie I shipped a new unstable version that might fix this (it also includes the latest Clojure alpha2): https://github.com/eval/deps-try/releases/tag/unstable (jar-file shrunk from ~13.5 to ~3MB).

lockie commented 1 year ago

@eval sorry to report it produces the same error message for me :weary:

eval commented 1 year ago

@lockie I just created a release that no longer depends on babashka.deps. I'm curious if this might (finally) fix this issue...

lockie commented 1 year ago

Thanks, it works for me now! Even though it says something about outdated Clojure CLI:

Adding (additional) libraries to this REPL-session via ':deps/try some/lib' won't work as it requires Clojure CLI version >= 1.11.1.1273 (current: 1.11.1.1165).
eval commented 1 year ago

Thanks for confirming it now works :).

Upgrading Clojure would solve the warning.