vegas-viz / Vegas

The missing MatPlotLib for Scala + Spark
MIT License
730 stars 98 forks source link

NoClassDefFoundError: cats/functor/Contravariant #136

Open dcram opened 6 years ago

dcram commented 6 years ago

Hi,

I am trying to run the example:

  import vegas._
  import vegas.render.WindowRenderer._

    val plot = Vegas("Country Pop").
      withData(
        Seq(
          Map("country" -> "USA", "population" -> 314),
          Map("country" -> "UK", "population" -> 64),
          Map("country" -> "DK", "population" -> 80)
        )
      ).
      encodeX("country", Nom).
      encodeY("population", Quant).
      mark(Bar)

    plot.show

But I get a:

Exception in thread "main" java.lang.NoClassDefFoundError: cats/functor/Contravariant
    at vegas.spec.Spec$LowPriorityImplicits$class.$init$(Spec.scala:1032)
    at vegas.spec.Spec$Implicits$.<init>(Spec.scala:2519)
    at vegas.spec.Spec$Implicits$.<clinit>(Spec.scala)
    at vegas.DSL.ExtendedUnitSpecBuilder.toJson(SpecDSL.scala:55)
    at vegas.DSL.SpecBuilder$SpecBuilderRenderOps$.window$extension(SpecDSL.scala:102)
    at ShowCalibrationFunction$$anonfun$main$1.apply(ShowCalibrationFunction.scala:54)
    at ShowCalibrationFunction$$anonfun$main$1.apply(ShowCalibrationFunction.scala:54)
    at vegas.render.ShowRender$$anon$1.apply(ShowRender.scala:12)
    at vegas.render.ShowRender$$anon$1.apply(ShowRender.scala:11)
    at vegas.DSL.SpecBuilder$SpecBuilderRenderOps$.show$extension(SpecDSL.scala:99)
    at ShowCalibrationFunction$.main(ShowCalibrationFunction.scala:54)
    at ShowCalibrationFunction.main(ShowCalibrationFunction.scala)
Caused by: java.lang.ClassNotFoundException: cats.functor.Contravariant
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 12 more

In my build.sbt:

import Dependencies._

lazy val commonSettings = Seq(
  organization := "fr.xxxxxxxxx",
  version := "0.1.0-SNAPSHOT",
  scalaVersion := "2.11.4",
  libraryDependencies += scalaTest % Test
)

lazy val root = (project in file(".")).
  settings(
    commonSettings,
    name := "xxxxxxxxxxxx",
    libraryDependencies ++= vegas
  )

In my Dependencies.scala:

  val vegasVersion = "0.3.11"
  lazy val vegas = Seq(
    "org.vegas-viz" %% "vegas" % vegasVersion
  )

What am I doing wrong ?

Thanks in advance for any help.

Damien

nikita-volkov commented 6 years ago

Just bumped into this. Looks like a conflict of the versions of the "cats" library used with some of the other deps

MJFND commented 4 years ago

Having the similar issue, using scala 2.11.12, can't see enough usage or issues around here.