1

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.

Alt
  • 2,597
  • 5
  • 26
  • 36
  • "I would like to install Breeze on the default scala installation" — it's not clear what that would even mean. What does it mean to you? What is your real goal here? – Seth Tisue Jul 30 '15 at 18:12
  • @SethTisue: I'll elaborate it. 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 I'll add more details to the question now. – Alt Jul 30 '15 at 18:22
  • What do you mean by "What is your real goal here?"? Clearly, I want to import Breeze. Therefore I have install it, but I don't want to install it through SBT. "REAL GOAL" was definitely funny :-P – Alt Jul 30 '15 at 18:29
  • "Therefore I have to install it" — in the JVM world one doesn't talk about "installing" libraries. Rather, you have JARs around, and you put them on the classpath at the same you start the JVM. Build tools such as sbt and maven automate the process of downloading JARs and adding them to your classpath, but it can be also be done manually. So you'd download e.g. `breeze.jar` somehow, and then say `scala -classpath breeze.jar`, and you're good to go. People don't use the word "install" to talk about this. That's why I was seeking clarification. Anyway, it looks like dlwh was able to help you. – Seth Tisue Jul 30 '15 at 21:58
  • @SethTisue: Thanks anyways, I have almost zero background in Java. – Alt Jul 31 '15 at 00:24

1 Answers1

1

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.

dlwh
  • 2,257
  • 11
  • 23
  • Producing the single jar with breeze's core dependencies solves the problem. Thanks! – Alt Jul 30 '15 at 20:51