Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Bug: Unable to load org.clojure/core.memoize library 0.5.3+ #794

Closed
chrisfjones opened this issue Sep 18, 2013 · 6 comments
Closed

Bug: Unable to load org.clojure/core.memoize library 0.5.3+ #794

chrisfjones opened this issue Sep 18, 2013 · 6 comments
Milestone

Comments

@chrisfjones
Copy link

Given the following project.clj:

(defproject memoize-test "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [org.clojure/core.memoize "0.5.6"]]
  :main memoize-test.core)

... and the following code

(ns memoize-test.core
  (:require [clojure.core.memoize :as memo]))

(def memo+ (memo/memo +))
(defn -main []
  (println (memo+ 1 1)))

... when loaded up in LT, produces the following errors:

java.lang.Exception: namespace 'clojure.core.memoize' not found
            core.clj:5380 clojure.core/load-lib
          RestFn.java:142 clojure.lang.RestFn.applyTo
             core.clj:619 clojure.core/apply
            core.clj:5413 clojure.core/load-libs
          RestFn.java:137 clojure.lang.RestFn.applyTo
             core.clj:619 clojure.core/apply
            core.clj:5496 clojure.core/require
          RestFn.java:408 clojure.lang.RestFn.invoke
         NO_SOURCE_FILE:1 memoize-test.core/eval4911[fn]
         NO_SOURCE_FILE:1 memoize-test.core/eval4911

... and in the context of a larger project has produced:

clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: No such var: clojure.core.cache/through, compiling:(clojure/core/memoize.clj:52:3)
             Compiler.java:6380 clojure.lang.Compiler.analyze
             Compiler.java:6322 clojure.lang.Compiler.analyze
             Compiler.java:3573 clojure.lang.Compiler$InvokeExpr.parse
...

... but works fine via 'lein run' or 'lein repl'

Also, changing the core.memoize version to 0.5.2 in the project.clj will cause the example to load and function perfectly in LT. core.memoize introduced a dependency on core.cache in 0.5.3+, which seems to be the culprit.

@ibdknox
Copy link
Member

ibdknox commented Sep 25, 2013

I'm desperately trying to figure this one out, I can get it to happen, but there's no obvious cause. Everything appears to be correct and only happens with core.memoize. I'm not the only one this seems to happen to either. lein-clojuredocs has a similar issue. I think it may actually be a problem with core.memoize itself.

@ibdknox ibdknox closed this as completed Sep 25, 2013
@ibdknox ibdknox reopened this Sep 25, 2013
@dzer6
Copy link

dzer6 commented Oct 2, 2013

Chris,

Try to add [org.clojure/core.cache "0.6.3"] to dependencies in project.clj

PS I found solution here: http://www.raynes.me/logs/irc.freenode.net/clojure/2013-09-11.txt

Andrew

@chrisfjones
Copy link
Author

Andrew,
Thanks! Adding that sequence:

[org.clojure/core.cache "0.6.3"]
[org.clojure/core.memoize "0.5.6" :exclusions [org.clojure/core.cache]]

..worked for me (even though memoize 0.5.6 has a transitive dependency on cache 0.6.3 anyway)

Looks like the clojure.core.cache/through function references its own clojure.core.cache namespace before its loaded - https://github.com/clojure/core.cache/blob/master/src/main/clojure/clojure/core/cache.clj#L53? Forcing lein to load that namespace first seems to bypass that problem somehow.

p.s. I'm amazed you were able to glean substance from that chat log ;)

@ibdknox
Copy link
Member

ibdknox commented Oct 10, 2013

fixed in 0.5.5 as far as I can tell.

@sritchie
Copy link

I was seeing the same thing when including this namespace from lib-noir:

[noir.util.middleware :as nm]

Problem fixed by explicitly including core.memoize 0.5.6.

@sventech
Copy link

I'm seeing the same error in core.memoize 0.5.7 (but not in 0.5.6) and the above solution fixed it.

ericlavigne added a commit to ericlavigne/planets_assistant that referenced this issue Apr 21, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants