1

I was following this tutorial on installing breeze, but I can't get it to work.

My directory structure:

myproject/
  build.sbt
  project/
    Build.scala # This is empty
  src/ 
    main/
      scala/
        hello.scala
    test/
      scala/
        my_tests.scala

My build.sbtlooks like this (It is mostly copied from the tutorial):

name := "My project"

libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.0"

libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test"

libraryDependencies  ++= Seq(
  // other dependencies here
  "org.scalanlp" %% "breeze" % "0.12",
  // native libraries are not included by default. add this if you want them (as of 0.7)
  // native libraries greatly improve performance, but increase jar sizes.
  // It also packages various blas implementations, which have licenses that may or may not
  // be compatible with the Apache License. No GPL code, as best I know.
  "org.scalanlp" %% "breeze-natives" % "0.12",
  // the visualization library is distributed separately as well.
  // It depends on LGPL code.
  "org.scalanlp" %% "breeze-viz" % "0.12"
)

resolvers ++= Seq(
  // other resolvers here
  // if you want to use snapshot builds (currently 0.12-SNAPSHOT), use this.
  "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/",
  "Sonatype Releases" at "https://oss.sonatype.org/content/repositories/releases/"
)

// or 2.11.5
scalaVersion := "2.11.8"

And my hello.scala file looks like this:

package mypackage

import breeze.linalg._

object Hello {

    def main(args: Array[String]): Unit = {
        println("Hello World")

        val x = Dense.Vector.zeros[Double](5)
        println(x)
    }
}

The error that I get looks like this:

         not found: value Dense
[error]         val x = Dense.Vector.zeros[Double](5)
[error]                 ^

            ^

I know that I adding unit test related libraries to libraryDependencies correctly, because my unit tests work after I add them. But what am I doing wrong when adding dependencies for breeze? What steps should I take to narrow down the problem?

Akavall
  • 82,592
  • 51
  • 207
  • 251

0 Answers0