s4ds | Code samples for Scala for data science
kandi X-RAY | s4ds Summary
kandi X-RAY | s4ds Summary
Code samples for Scala for data science
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of s4ds
s4ds Key Features
s4ds Examples and Code Snippets
Community Discussions
Trending Discussions on s4ds
QUESTION
I am following this scala for data science book and git cloned all the sample codes from its repo. And when I first do sbt console
and type in import breeze.lianlg._
command, it works fine. But if I ran a script that starts with a line import breeze.linalg._
, the script could not run thru and the error messages indicate the importing is not successful. How do I fix this and make the script run? Thanks!
Edit: this is how the build.sbt file looks:
...ANSWER
Answered 2018-Sep-24 at 19:35The problem is that when you run console from SBT you're inside the project space, which includes your libraries.
But when you execute the script on its own, it is in the system space, and the libraries aren't present.
Couple of options here:
- Create an Uber JAR, instead of an script.
- Add those libraries to your CLASSPATH.
- Use Ammonite.
The most common solution to this problem in general is to create an Uber JAR. It is also the most portable one, because now you have a jar with all its dependencies included, so you can run it anywhere - Also, because it is a Jar, you don't even need Scala anymore, just a JRE.
If you're going this way, check sbt-assembly. However, since you have probably a small script, going this way could be an overkill to your problem - but keep in mind that for larger projects this is the canonical solution.
The CLASSPATH env variable indicates Java where to search for classes (usually contained in libraries - Jars), so you only need to update this variable to include the missing libraries, you could do this by creating a folder (e.g. /opt/jars/) and downloading all jars to that folder, and then adding a line like one this in your .bashrc
file, to make sure the env var is updated every time yo open a shell.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install s4ds
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page