Setup the MXNet Package for Scala¶
The following instructions are provided for macOS and Ubuntu. Windows is not yet available.
Note: If you use IntelliJ or a similar IDE, you may want to follow the MXNet-Scala on IntelliJ tutorial instead of these instructions.
Step 1. Install dependencies:
brew update brew tap caskroom/versions brew cask install java8 brew install opencv brew install maven
These scripts will install Maven and its dependencies.
wget https://raw.githubusercontent.com/apache/incubator-mxnet/master/ci/docker/install/ubuntu_core.sh wget https://raw.githubusercontent.com/apache/incubator-mxnet/master/ci/docker/install/ubuntu_scala.sh chmod +x ubuntu_core.sh chmod +x ubuntu_scala.sh sudo ./ubuntu_core.sh sudo ./ubuntu_scala.sh
Step 2. Run the demo MXNet-Scala project.
Go to the MXNet-Scala demo project’s README and follow the directions to test the MXNet-Scala package installation.
Package information can be found in the Maven Repository: https://mvnrepository.com/artifact/org.apache.mxnet
<!-- https://mvnrepository.com/artifact/org.apache.mxnet/mxnet-full_2.11-linux-x86_64-cpu --> <dependency> <groupId>org.apache.mxnet</groupId> <artifactId>mxnet-full_2.11-linux-x86_64-cpu</artifactId> </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.mxnet/mxnet-full_2.11-linux-x86_64-gpu --> <dependency> <groupId>org.apache.mxnet</groupId> <artifactId>mxnet-full_2.11-linux-x86_64-gpu</artifactId> </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.mxnet/mxnet-full_2.11-osx-x86_64-cpu --> <dependency> <groupId>org.apache.mxnet</groupId> <artifactId>mxnet-full_2.11-osx-x86_64-cpu</artifactId> </dependency>
NOTE: You may specify the version you wish to use by adding the version number to the
dependency block. For example, to use v1.2.0 you would add
<version>1.2.0</version>. Otherwise Maven will use the latest version available.
The previously mentioned setup with Maven is recommended. Otherwise, the following instructions for macOS, Ubuntu, and Windows are provided for reference only:
|OS||Step 1||Step 2|
|macOS||Shared Library for macOS||Scala Package for macOS|
|Ubuntu||Shared Library for Ubuntu||Scala Package for Ubuntu|
|Windows||Shared Library for Windows||Call for Contribution|
Build Scala from an Existing MXNet Installation¶
If you have already built MXNet from source and are looking to setup Scala from that point, you may simply run the following from the MXNet source root:
make scalapkg make scalainstall
Scaladocs are generated as part of the docs build pipeline. You can find them published in the Scala API section of the website or by going to the scaladocs output directly.
To build the docs yourself, follow the developer build docs instructions.