Search code examples
macosscalascala-breeze

How to install Scala Breeze on Mac (not using sbt)


I have installed the Breeze package using sbt.

But it looks like that the sbt's scala is a different installation than the default scala repl on my Mac.

I would like to install Breeze on the default scala installation. But I don't know how! Edit:

By the default installation of Scala, I mean the one that is detectable by the which command: MacBook-Pro:bin alt$ which scala /usr/local/bin/scala

Now, if I run scala and import breeze.linalg._

MacBook-Pro:bin alt$ scala
Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_79).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import breeze.linalg._
<console>:7: error: not found: value Breeze
       import breeze.linalg._

But if I scala through sbt then the import works and I have access to Breeze's sub-libraries.

(I'm new to both Mac and Scala.) Any help is appreciated.


Solution

  • First, it's import breeze.linalg._ not import Breeze.linalg._

    As for actually "installing" Breeze. I don't have a great solution for you. Probably easiest is to check out the breeze project on github, and then run "sbt assembly", which should produce a single jar with all of (core) breeze's dependencies. You can then add that jar to the classpath in the usual ways.

    It won't include breeze-viz or the native libraries. For those you should e.g. run sbt "project natives" assembly and use that jar.