| |
| <!DOCTYPE html> |
| |
| <html> |
| <head> |
| <meta charset="utf-8" /> |
| <title>Setting up IDEs — PySpark 3.2.0 documentation</title> |
| |
| <link href="../_static/css/theme.css" rel="stylesheet" /> |
| <link href="../_static/css/index.c5995385ac14fb8791e8eb36b4908be2.css" rel="stylesheet" /> |
| |
| |
| <link rel="stylesheet" |
| href="../_static/vendor/fontawesome/5.13.0/css/all.min.css"> |
| <link rel="preload" as="font" type="font/woff2" crossorigin |
| href="../_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff2"> |
| <link rel="preload" as="font" type="font/woff2" crossorigin |
| href="../_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2"> |
| |
| |
| |
| |
| |
| <link rel="stylesheet" href="../_static/basic.css" type="text/css" /> |
| <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> |
| <link rel="stylesheet" type="text/css" href="../_static/css/pyspark.css" /> |
| |
| <link rel="preload" as="script" href="../_static/js/index.1c5a1a01449ed65a7b51.js"> |
| |
| <script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> |
| <script src="../_static/jquery.js"></script> |
| <script src="../_static/underscore.js"></script> |
| <script src="../_static/doctools.js"></script> |
| <script src="../_static/language_data.js"></script> |
| <script src="../_static/copybutton.js"></script> |
| <script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script> |
| <script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script> |
| <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "tex2jax_ignore|mathjax_ignore|document", "processClass": "tex2jax_process|mathjax_process|math|output_area"}})</script> |
| <link rel="canonical" href="https://spark.apache.org/docs/latest/api/python/development/setting_ide.html" /> |
| <link rel="search" title="Search" href="../search.html" /> |
| <link rel="next" title="Migration Guide" href="../migration_guide/index.html" /> |
| <link rel="prev" title="Debugging PySpark" href="debugging.html" /> |
| <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| <meta name="docsearch:language" content="en" /> |
| |
| </head> |
| <body data-spy="scroll" data-target="#bd-toc-nav" data-offset="80"> |
| |
| <div class="container-fluid" id="banner"></div> |
| |
| |
| <nav class="navbar navbar-light navbar-expand-lg bg-light fixed-top bd-navbar" id="navbar-main"><div class="container-xl"> |
| |
| <div id="navbar-start"> |
| |
| |
| |
| <a class="navbar-brand" href="../index.html"> |
| <img src="../_static/spark-logo-reverse.png" class="logo" alt="logo"> |
| </a> |
| |
| |
| |
| </div> |
| |
| <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-collapsible" aria-controls="navbar-collapsible" aria-expanded="false" aria-label="Toggle navigation"> |
| <span class="navbar-toggler-icon"></span> |
| </button> |
| |
| |
| <div id="navbar-collapsible" class="col-lg-9 collapse navbar-collapse"> |
| <div id="navbar-center" class="mr-auto"> |
| |
| <div class="navbar-center-item"> |
| <ul id="navbar-main-elements" class="navbar-nav"> |
| <li class="toctree-l1 nav-item"> |
| <a class="reference internal nav-link" href="../getting_started/index.html"> |
| Getting Started |
| </a> |
| </li> |
| |
| <li class="toctree-l1 nav-item"> |
| <a class="reference internal nav-link" href="../user_guide/index.html"> |
| User Guide |
| </a> |
| </li> |
| |
| <li class="toctree-l1 nav-item"> |
| <a class="reference internal nav-link" href="../reference/index.html"> |
| API Reference |
| </a> |
| </li> |
| |
| <li class="toctree-l1 current active nav-item"> |
| <a class="reference internal nav-link" href="index.html"> |
| Development |
| </a> |
| </li> |
| |
| <li class="toctree-l1 nav-item"> |
| <a class="reference internal nav-link" href="../migration_guide/index.html"> |
| Migration Guide |
| </a> |
| </li> |
| |
| |
| </ul> |
| </div> |
| |
| </div> |
| |
| <div id="navbar-end"> |
| |
| <div class="navbar-end-item"> |
| <ul id="navbar-icon-links" class="navbar-nav" aria-label="Icon Links"> |
| </ul> |
| </div> |
| |
| </div> |
| </div> |
| </div> |
| </nav> |
| |
| |
| <div class="container-xl"> |
| <div class="row"> |
| |
| |
| <!-- Only show if we have sidebars configured, else just a small margin --> |
| <div class="col-12 col-md-3 bd-sidebar"><form class="bd-search d-flex align-items-center" action="../search.html" method="get"> |
| <i class="icon fas fa-search"></i> |
| <input type="search" class="form-control" name="q" id="search-input" placeholder="Search the docs ..." aria-label="Search the docs ..." autocomplete="off" > |
| </form><nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation"> |
| <div class="bd-toc-item active"> |
| <ul class="current nav bd-sidenav"> |
| <li class="toctree-l1"> |
| <a class="reference internal" href="contributing.html"> |
| Contributing to PySpark |
| </a> |
| </li> |
| <li class="toctree-l1"> |
| <a class="reference internal" href="testing.html"> |
| Testing PySpark |
| </a> |
| </li> |
| <li class="toctree-l1"> |
| <a class="reference internal" href="debugging.html"> |
| Debugging PySpark |
| </a> |
| </li> |
| <li class="toctree-l1 current active"> |
| <a class="current reference internal" href="#"> |
| Setting up IDEs |
| </a> |
| </li> |
| </ul> |
| |
| </div> |
| </nav> |
| </div> |
| |
| |
| |
| |
| <div class="d-none d-xl-block col-xl-2 bd-toc"> |
| |
| |
| <div class="toc-item"> |
| |
| <div class="tocsection onthispage pt-5 pb-3"> |
| <i class="fas fa-list"></i> On this page |
| </div> |
| |
| <nav id="bd-toc-nav"> |
| <ul class="visible nav section-nav flex-column"> |
| <li class="toc-h2 nav-item toc-entry"> |
| <a class="reference internal nav-link" href="#pycharm"> |
| PyCharm |
| </a> |
| </li> |
| </ul> |
| |
| </nav> |
| </div> |
| |
| <div class="toc-item"> |
| |
| </div> |
| |
| |
| </div> |
| |
| |
| |
| |
| |
| |
| <main class="col-12 col-md-9 col-xl-7 py-md-5 pl-md-5 pr-md-4 bd-content" role="main"> |
| |
| <div> |
| |
| <div class="section" id="setting-up-ides"> |
| <h1>Setting up IDEs<a class="headerlink" href="#setting-up-ides" title="Permalink to this headline">¶</a></h1> |
| <div class="section" id="pycharm"> |
| <h2>PyCharm<a class="headerlink" href="#pycharm" title="Permalink to this headline">¶</a></h2> |
| <p>This section describes how to setup PySpark on PyCharm. |
| It guides step by step to the process of downloading the source code from GitHub and running the test code successfully.</p> |
| <p>Firstly, download the Spark source code from GitHub using git url. You can download the source code by simply using <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">clone</span></code> command as shown below. |
| If you want to download the code from any forked repository rather than Spark original repository, please change the url properly.</p> |
| <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>git clone https://github.com/apache/spark.git |
| </pre></div> |
| </div> |
| <p>When the download is completed, go to the <code class="docutils literal notranslate"><span class="pre">spark</span></code> directory and build the package. |
| SBT build is generally much faster than Maven. More details about the build are documented <a class="reference external" href="https://spark.apache.org/docs/latest/building-spark.html">here</a>.</p> |
| <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>build/sbt package |
| </pre></div> |
| </div> |
| <p>After building is finished, run PyCharm and select the path <code class="docutils literal notranslate"><span class="pre">spark/python</span></code>.</p> |
| <img alt="Select the Spark path" src="../_images/pycharm-with-pyspark1.png" /> |
| <p>Let’s go to the path <code class="docutils literal notranslate"><span class="pre">python/pyspark/tests</span></code> in PyCharm and try to run the any test like <code class="docutils literal notranslate"><span class="pre">test_join.py</span></code>. |
| You might can see the <code class="docutils literal notranslate"><span class="pre">KeyError:</span> <span class="pre">'SPARK_HOME'</span></code> because the environment variable has not been set yet.</p> |
| <p>Go <strong>Run -> Edit Configurations</strong>, and set the environment variables as below. |
| Please make sure to specify your own path for <code class="docutils literal notranslate"><span class="pre">SPARK_HOME</span></code> rather than <code class="docutils literal notranslate"><span class="pre">/.../spark</span></code>. After completing the variable, click <strong>OK</strong> to apply the changes.</p> |
| <img alt="Setting up SPARK_HOME" src="../_images/pycharm-with-pyspark2.png" /> |
| <p>Once <code class="docutils literal notranslate"><span class="pre">SPARK_HOME</span></code> is set properly, you’ll be able to run the tests properly as below:</p> |
| <img alt="Running tests properly" src="../_images/pycharm-with-pyspark3.png" /> |
| </div> |
| </div> |
| |
| |
| </div> |
| |
| |
| <div class='prev-next-bottom'> |
| |
| <a class='left-prev' id="prev-link" href="debugging.html" title="previous page">Debugging PySpark</a> |
| <a class='right-next' id="next-link" href="../migration_guide/index.html" title="next page">Migration Guide</a> |
| |
| </div> |
| |
| </main> |
| |
| |
| </div> |
| </div> |
| |
| <script src="../_static/js/index.1c5a1a01449ed65a7b51.js"></script> |
| |
| <footer class="footer mt-5 mt-md-0"> |
| <div class="container"> |
| |
| <div class="footer-item"> |
| <p class="copyright"> |
| © Copyright .<br/> |
| </p> |
| </div> |
| |
| <div class="footer-item"> |
| <p class="sphinx-version"> |
| Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.4.<br/> |
| </p> |
| </div> |
| |
| </div> |
| </footer> |
| </body> |
| </html> |