3

I am playing around with incanter as I am learning clojure and I keep getting an error message when I try to create a matrix in REPL under lein:

user=> (use 'incanter.io)
nil
user=> (use 'incanter.core)
nil
user=> (def A (matrix [[1 2 3] [4 5 6] [7 8 9]])) 
NoSuchMethodError edu.emory.mathcs.utils.ConcurrencyUtils.getThreads
BeginN_2D()Icern.colt.matrix.tdouble.impl.DenseColumnDoubleMatrix2D.assign (DenseColumnDoubleMatrix2D.java:661)

It looks like a dependency issue but yet not sure how to resolve this.

Marshall Shen
  • 1,323
  • 12
  • 17
  • What version of incanter are you using? This works fine with 1.3.0 but not with 1.4.0. – Diego Basch Dec 30 '12 at 00:54
  • Ah, I'm using 1.4.0, I will verify if it works on 1.3.0 and submit an issue on Github if that's case. – Marshall Shen Dec 30 '12 at 01:11
  • @DiegoBasch You're right. – Marshall Shen Dec 30 '12 at 01:13
  • Very strange, I can't reproduce this issue with 1.4.0. Can you show your `project.clj`? – Alex Ott Dec 30 '12 at 14:00
  • (defproject project_name "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.4.0"] [incanter "1.4.0"] [clj-http "0.6.2"] [yfinance "0.2.0"] [clj-time "0.4.4"] ]) – Marshall Shen Dec 30 '12 at 20:00

1 Answers1

1

Hit the same issue using [org.clojure/clojure "1.4.0"] and [incanter "1.4.1"]. Def had a classpath shadowing feel to it.

Did the following in repl to figure out which jar ConcurrencyUtils was coming from:

(.getResource edu.emory.mathcs.utils.ConcurrencyUtils
    "/edu/emory/mathcs/utils/ConcurrencyUtils.class")

This pointed at jplasma. Sure enough, jplasma has its own copy of that class that has various methods including getThreadsBeginN_2D missing.

Looking at the deps ("lein pom" followed by "mvn dependency:tree") showed this to be a dependency pulled in by incanter 1.4.1:

[INFO] |  +- incanter:incanter-core:jar:1.4.1:compile
[INFO] |  |  +- org.clojure:math.combinatorics:jar:0.0.3:compile
[INFO] |  |  \- net.sourceforge.parallelcolt:parallelcolt:jar:0.10.0:compile
[INFO] |  |     +- net.sourceforge.jplasma:jplasma:jar:1.2.0:compile

Changed the entry for incanter in project.clj to exclude jplasma:

[incanter "1.4.1"
    :exclusions [net.sourceforge.jplasma/jplasma]]

This gets ConcurrencyUtils from jtransforms (hence still not from parallelcolt), but at least fixes the matrix problem:

=> (matrix [[1 2 3] [4 5 6] [7 8 9]])
[1.0000 2.0000 3.0000
4.0000 5.0000 6.0000
7.0000 8.0000 9.0000]

Not sure what the impact of the exclusion is. There is an older version of jplasma on clojars which doesn't break matrix, you could try adding that to your project.clj:

[incanter/jplasma "0.9.4"]

These deps clearly need sorting properly though, by someone who understands them.

u-phoria
  • 364
  • 4
  • 13