Jupyter Spark Environment Configuration (online, offline can be achieved) _jupyter

Source: Internet
Author: User
Tags jupyter jupyter notebook pyspark
Application scenarios in order to be able to develop spark programs in Jupyter, Bowen records the process of configuring spark development environment in Jupyter. Many blogs can not effectively build jupyter spark development environment. Prerequisite Components Spark Downloads
Spark-2.3.0-bin-hadoop2.7.tgz Apache Toree
Apache Toree has one main goal:provide the foundation for interactive applications to connect and use Apache Spark. Download Address
Apache/incubator-toree GitHub Source code incubator/toree tar package download Callout:
System environment is not installed Scala, Hadoop
[Root@localhost bin]# cat/etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
installation Command Online install
The Anaconda environment variable is already in the Linux PATH environment variable, is not configured, or is switched to the Anaconda Bin directory and is installed and configured using the PIP command.
# Your-spark-home:spark installation package path
pip install toree
jupyter toree Install--spark_home=your-spark-home
Offline install
Download GitHub source code, TAR packets can be offline installation. Source Code Installation
/root/anaconda2/bin/python setup.py Install jupyter toree install--spark_home=your-spark-home Test Code test environment is built successfully
Import Org.apache.spark.sql.SparkSession

object Sparksqldemo {
    val sparksession = Sparksession.builder ().
        Master ("local[1]")
        . AppName ("Spark Session Example")
        . Getorcreate ()

    def main (args:array[string]) {
        val input = SparkSession.read.json ("Cars1.json")
        Input.createorreplacetempview ("Cars1")
        val result = Sparksession.sql ("SELECT * from Cars1")
        result.show ()
    }
}

Sparksqldemo.main (Array ()) # call method
Execution results
Extensions: Installing multiple cores installing multiple kernels
Options--interpreters=<unicode> (toreeinstall.interpreters)
Default: ' Scala '
A Comma separated list of the interpreters to install. The names of the
Interpreters are case sensitive.
Jupyter Toree Install--interpreters=scala,pyspark,sparkr,sql
References jupyter Notebook toree Configuration Pyspark development environment and its working principle. Jupyter notebook installation based on Pyspark and Scala Spark is recommended. Recommended Apache Spark in Python:beginner ' s Guide. Recommended toree-0.2.0.dev1.tar.gz Apache Toree hadoop-common-2.2.0-bin FAQs How do I visualize data? Only one sparkcontext maybe running into this JVM

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.