taoensso / timbre

Pure Clojure/Script logging library
https://www.taoensso.com/timbre
Eclipse Public License 1.0
1.44k stars 171 forks source link

Namespace 'taoensso.timbre.appenders.core' not found error on Import #325

Closed ashwinbhaskar closed 2 years ago

ashwinbhaskar commented 3 years ago

I am using [com.taoensso/timbre "5.1.0"]. When I import [taoensso.timbre :as t] and load the file in REPL, I get the following error

Syntax error compiling at (taoensso/timbre.cljc:1:1).
namespace 'taoensso.timbre.appenders.core' not found

But I am able to navigate to that taoensso.timbre.appenders.core. What could be causing this issue?

ptaoussanis commented 3 years ago

Hi Ashwin!

Could you please try the steps in https://github.com/ptaoussanis/encore#recommended-steps-after-any-significant-dependency-update, and let me know if that helps?

Thanks

basilesportif commented 11 months ago

Have the same issue, and the link above no longer points to anything.

ptaoussanis commented 11 months ago

@timlucmiptev Hi Basile,

Have the same issue, and the link above no longer points to anything.

The previous link pointed to "Step 3/3" here: https://www.taoensso.com/dependency-conflicts

Please let me know if that helps?

basilesportif commented 11 months ago

It did, in that I was able to isolate the actual issue, which was that compilation fails earlier with No such var: enc/println-atomic

ptaoussanis commented 11 months ago

It did, in that I was able to isolate the actual issue, which was that compilation fails earlier with No such var: enc/println-atomic

Great, thanks for the confirmation 👍 That then sounds like a dependency conflict - for which steps 1-2 on the same page should be applicable.

U-C-S commented 2 months ago

I prefer using Calva for connecting to REPL but it throws Syntax error compiling at (taoensso/timbre/appenders/core.cljc:50:11) No such var: enc/println-atomic. it doesn't error and works fine when I start REPL from lein repl CLI command.

Calva uses this command to start the REPL

lein update-in :dependencies conj '[nrepl/nrepl,"1.1.1"]' -- update-in :plugins conj '[cider/cider-nrepl,"0.47.1"]' -- update-in '[:repl-options,:nrepl-middleware]' conj '["cider.nrepl/cider-middleware"]' -- with-profile +something repl

I also had a look into lein deps :tree, Only dep I notice that's conflicting with timbre is org.clojure/tools.reader

ptaoussanis commented 2 months ago

@U-C-S Hi Chanakya, I'm not familiar with Calva - how are you specifying your dependencies?

Have you tried the linked steps to resolve?

U-C-S commented 2 months ago

Thanks for the quick response

Yes, i did follow linked steps to resolve and here's my project.clj after that

(defproject something-server "0.20200609"
  :dependencies [[org.clojure/clojure "1.11.1"]
                 [io.pedestal/pedestal.service "0.5.10"]
                 [io.pedestal/pedestal.route "0.5.10"]
                 [io.pedestal/pedestal.jetty "0.5.10"]
                 .
                 .
                 [com.taoensso/encore "3.85.0"]
                 [com.taoensso/timbre "6.5.0"]
                 [com.fzakaria/slf4j-timbre "0.4.1"]
                 [org.slf4j/slf4j-api "1.7.30"]
                 [jdbc-ring-session "1.3"
                  :exclusions [com.taoensso/nippy]]
                 [integrant]
                 [integrant/repl]
                 [com.taoensso/carmine]
                 .
                 .
                 [nrepl/nrepl]]
  :plugins [[lein-environ "1.1.0"]
            [lein-pprint "1.2.0"]
            [cider/cider-nrepl "0.47.1"]] ;; this
  :profiles {:import 
                  {:injections [(->> 'something.csv-import/dev-config
                               requiring-resolve
                               var-get
                               (partial integrant.core/prep)
                               integrant.repl/set-prep!)]
                   :repl-options {:nrepl-middleware ["cider.nrepl/cider-middleware"]}  ;; this
                   :main ^:skip-aot something.csv-import}})

I added cider-nrepl as a plugin and configured :repl-options accordingly, (which is what the calva command does) and now lein repl also fails with same error. But if I remove the cider-nrepl and :repl-options, repl runs normally

ptaoussanis commented 2 months ago

Could you please try again using the latest version of Encore?

I.e. please replace [com.taoensso/encore "3.85.0"] in your :dependencies with [com.taoensso/encore "3.113.0"].

If there's any errors, please share the exact error/s.

It might also be worth trying to move [com.taoensso/encore "3.113.0"] to the top of your :dependencies, especially if those "."'s mean that you're truncating your list of dependencies.

U-C-S commented 2 months ago

I tried with the latest version and also moving the dep to top, still the same error. Nothing in the truncated "." deps are related to this atleast. Guessing this error is more related to lein and cider-nrepl, Maybe I will try messing with config of both a bit more, but appreciate for the help so far.

the exact error

$ lein repl
WARNING: abs already refers to: #'clojure.core/abs in namespace: clojure.test.check.generators, being replaced by: #'clojure.test.check.generators/abs
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/chanakya/.m2/repository/com/fzakaria/slf4j-timbre/0.4.1/slf4j-timbre-0.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/chanakya/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Syntax error compiling at (taoensso/timbre/appenders/core.cljc:50:17).
No such var: enc/println-atomic

Full report at:
/var/folders/nn/s7bvrvgd6550r1cglzrqdh500000gn/T/clojure-9843509124901983690.edn
Subprocess failed (exit code: 1)
REPL server launch timed out.
ptaoussanis commented 2 months ago

appreciate for the help so far

No worries, you're welcome 👍 Sorry you're running into trouble!

Just to confirm: running lein clean doesn't help?

No such var: enc/println-atomic most likely implies that an older version of Encore is somehow being used [0]. (It for sure exists in v3.113.0).

Possible causes (sorted in ~order of expected probability):

  1. One of your deps is AOT'd against an older version of Encore.
  2. Something is indirectly influencing your deps.
  3. Something is setting the taoensso.elide-deprecated JVM prop or related ENV var, causing the mentioned var to be elided.
  4. Something else.

For [0]: You could try print enc/encore-version to confirm.

For [1]: this can be difficult to pinpoint. You'd need to check which of your deps is AOT'd and uses Encore. I'd start by checking slf4j-timbre since I believe that can sometimes be a bit fragile.

For [2]: I'd double check lein deps :tree, ~/.lein/profiles.clj (or equivalent), and plugins that may influence deps

For [3]: You could try print (enc/get-env {:as :bool} :taoensso.elide-deprecated<.platform>). If that's true, something is setting the relevant system value.

For [4]: I'd recommend trying to setup a minimal project that works - then start adding your dependencies or project.clj customizations in 1-by-1 until you can identify what's causing the problem.

Feel free to ping here if you there's any questions I can help with!